Skip to content

Commit

Permalink
fix: set up environment variable during preview resolving too
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Jan 10, 2022
1 parent c01f62a commit 1418aca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/prismicPreview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export const resolve = async (
return null;
}

process.env.ELEVENTY_SERVERLESS_PRISMIC_PREVIEW = "true";

const client = createClientFromOptions(options);
const href = await client.resolvePreviewURL({
documentID,
Expand All @@ -37,6 +39,8 @@ export const resolve = async (
defaultURL: `/${options.preview.name}`,
});

delete process.env.ELEVENTY_SERVERLESS_PRISMIC_PREVIEW;

const previewCookie = {
[new URL(client.endpoint).host.replace(/\.cdn/i, "")]: {
preview: previewToken,
Expand Down

0 comments on commit 1418aca

Please sign in to comment.