Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft mode #94

Open
RokasVCheckatrade opened this issue Oct 11, 2024 · 2 comments · May be fixed by #97
Open

Draft mode #94

RokasVCheckatrade opened this issue Oct 11, 2024 · 2 comments · May be fixed by #97

Comments

@RokasVCheckatrade
Copy link

Hello, I'm trying to build an app that relies on draft mode and I just cannot get it to work on cloudflare using edge runtime. It seems that edge is missing some environment variables that get set in vercel.

In particular I've tracked it down to these:

'__NEXT_PREVIEW_MODE_ENCRYPTION_KEY',
'__NEXT_PREVIEW_MODE_ID',
'__NEXT_PREVIEW_MODE_SIGNING_KEY',

This is the method that uses them: https://github.com/vercel/next.js/blob/canary/packages/next/src/server/web/get-edge-preview-props.ts

Any ideas if I'm just missing some sort of setup from my side? Or is it missing support from cloudflare side? Thanks!

@shashankboosi
Copy link
Contributor

shashankboosi commented Oct 12, 2024

Hey @RokasVCheckatrade,

I have a similar use case where I use cookies to enable a service but in the current state the adapter doesn't support the middleware and routing behavior that next.js uses. But @vicb said they plan to do this and I think once that is done, draft mode should work automatically or get it working with a small tweak :)

I hope this helps!

@james-elicx james-elicx linked a pull request Oct 12, 2024 that will close this issue
@james-elicx
Copy link
Collaborator

Hi @RokasVCheckatrade, I'm not sure if it will fix your problem because it might be due to middleware, but I've got a PR up that will define these environment variables on process.env.

Could you try out the prerelease in #97 (comment) and see if that helps you at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants