Repository navigation
fix(patches): include preview-props.json in loadManifest glob for Next.js 16.4 - #1356
Conversation
…t.js 16.4 Next.js 16.4 moved preview props out of prerender-manifest.json into a standalone .next/server/preview-props.json, loaded unconditionally by NextNodeServer.getPreviewProps(). Its name doesn't end in -manifest, so the glob in load-manifest.ts missed it and every dynamic route 500d. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
🦋 Changeset detectedLatest commit: 7b41573 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
- Add @opennextjs/cloudflare and wrangler config (Smart Placement, Hyperdrive binding, observability). - Replace the global `db` with `getDb()`: one Hyperdrive-backed client per request on Workers (sockets can't cross requests), the DATABASE_URL client everywhere else. next-auth now builds its config per request. - Set `trustHost` so Auth.js accepts the Worker's hostname. - Pin Next to 16.3.x: the adapter 500s on 16.4 until opennextjs/opennextjs-cloudflare#1356 ships; Dependabot ignores 16.4+. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01LcV53ESAdFnYAbNewkMuUD
…#25118) `@opennextjs/cloudflare` throws on the new `preview-props.json` manifest that Next.js 16.4 loads, so every request in the `(latest)` variant returns a 500 (opennextjs/opennextjs-cloudflare#1355). This pins the variant to 16.3 until the upstream fix (opennextjs/opennextjs-cloudflare#1356) is released, and we should switch it back to `next@latest` then. Co-authored-by: Claude Opus 5.5 <[email protected]>
Confirming this on the stable release: [email protected] (released 2026-10-07) with @opennextjs/[email protected]. Every dynamic route (server-rendered pages and route handlers) returns 500 with: Prerendered and static pages still serve normally. That makes the break easy to miss in a quick smoke test of the homepage, but anything rendered per request fails. Now that 16.4.0 is stable, anyone on Cloudflare who upgrades Next will hit it. We applied this PR's one-line glob change as a package patch on top of 1.20.9, and it fixes it for us on 16.4.0. The build succeeds, It would be great to get this merged and into a release. Happy to test a pre-release build. |
|
this fix is really needed to settled alot of things for us. |
…props.json manifest
Live site was crashing on every request with Error 1101 ("Unexpected
loadManifest(/.next/server/preview-props.json) call!"). Next.js's
NextNodeServer constructor unconditionally calls getPreviewProps(),
which loads .next/server/preview-props.json — a manifest the installed
@opennextjs/[email protected] doesn't yet know is safe to be missing,
so its patched loadManifest() throws instead of returning {} like
Next.js's own handleMissing:true behavior. Upstream fix is open but
unreleased: opennextjs/opennextjs-cloudflare#1356
Reproduced the exact crash locally via `wrangler dev --local` against
an unpatched build, confirmed the patch resolves it, confirmed /, /shop
and /sign-in all return 200 against the patched build.
Also commits a proper wrangler.jsonc + open-next.config.ts (previously
regenerated fresh via an interactive migrate flow on every single CI
deploy, since neither was in version control) so @opennextjs/cloudflare
is pinned and patched consistently instead of drifting between builds.
patch-package reapplies the fix automatically via postinstall.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Next 16.4 で増えた .next/server/preview-props.json を、@opennextjs/cloudflare が manifest として Worker に埋め込まず、起動時に例外になっていた。upstream の修正 (opennextjs/opennextjs-cloudflare#1356)が出るまで、ビルド直前に glob へ足す。 あわせて、Next 16.3 以降の cache handler のパッチが直った 1.20.10 に上げる。 Co-authored-by: Claude Opus 5.5 <[email protected]>
Next.js 16.4.0 moved preview props into a separate
`.next/server/preview-props.json` manifest that
`NextNodeServer.getPreviewProps()` loads unconditionally during server
construction. OpenNext's build-time `loadManifest` inliner only globs
`{*-manifest,required-server-files,prefetch-hints}.json`, so the call
fell through to `throw new Error("Unexpected loadManifest(...) call!")`
and the bts-web worker failed on every request (even GET /favicon.ico).
Patch @opennextjs/[email protected] so the glob also matches
`preview-props.json`, mirroring upstream
opennextjs/opennextjs-cloudflare#1356. The patch is version-pinned to
1.20.9 so it stops applying once the adapter is upgraded.
Verified locally with `wrangler dev`: GET / and /docs return 200 with no
`loadManifest` errors; `bun install --frozen-lockfile` reapplies the
patch on a clean install.
vicb
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I made some minor updates and syncd with the latest main
commit: |
Problem
Next.js 16.4 moved preview props out of
prerender-manifest.jsoninto a standalone.next/server/preview-props.json, loaded unconditionally byNextNodeServer.getPreviewProps(). Its name doesn't end in-manifest, so the glob inload-manifest.tsmisses it and every dynamic route 500s withUnexpected loadManifest(/.next/server/preview-props.json) call!.Fix
Add
preview-propsto the glob, as #1160 did forprefetch-hints. Not thereturn {}fallback from #1151 — that's for optional manifests; this one is loaded unconditionally and holds the real draft-mode keys, so it has to be inlined.Fixes #1355.
🤖 Generated with Claude Code