**Error:**

Error: [wrangler:inf] Ready on http://localhost:8788 ✨ Parsed 1 valid header rule. Enable Draft Mode: ✘ [ERROR] Error: Invariant: previewProps missing previewModeId this should never happen When: - Trying to activate draft mode in a Nexjs 14.2.15 (current version) - Using app router and defining edge runtime. - Works when running locally in dev, but not with next-on-pages (using wrangler pages dev) Reproduce: https://github.com/hsnilsson/nextjs-draftmode-next-on-pages-reproduction Created a reproduction repo. The last commit (https://github.com/hsnilsson/nextjs-draftmode-next-on-pages-reproduction/commit/be6ca46658ed28007eb35ac9fef72b57c62cb11e) explains the issue more.
3 Replies
hsnilsson
hsnilssonOP4w ago
Might be related to a recent change in how Next injects the "preview props" for draft mode in edge runtime. It now uses env vars instead of prerender manifest (https://github.com/vercel/next.js/commit/1d9a78c1cbb6f65e57a41d1282591a8d9e1c4caf#diff-1f7cb348a2c0cd0f796f813e816b86a9443b4a6ecfa331d34edc8e3ccdc79319L43)
GitHub
Fix edge preview props are not matched with cookie (#67779) · verce...
What Chnage the way of preview props injection to edge runtime, directly read from env vars of preview props instead of writing to and reading from prerender manifest.js Why Prev...
hsnilsson
hsnilssonOP4w ago
So maybe when running next-on-pages, due to how env variables are handled, those preview props doesn't come through somehow 🤔 I'm not sure how to move forward, but would definitely help out solving this 🙏
hsnilsson
hsnilssonOP4w ago
Just found an issue put on this: https://github.com/cloudflare/next-on-pages/issues/883 (same conclusion as I got to)
GitHub
[⚡ Feature]: Draft Mode · Issue #883 · cloudflare/next-on-pages
Description Draft Mode allows you to preview draft content from your headless CMS in your Next.js application. This is useful for static pages that are generated at build time as it allows you to s...
Want results from more Discord servers?
Add your server