Skip to content

fix(patches): include preview-props.json in loadManifest glob for Next.js 16.4 - #1356

Merged
vicb merged 3 commits into
opennextjs:mainfrom
chargome:fix/preview-props-manifest
Oct 15, 2026
Merged

vicb merged 3 commits into
opennextjs:mainfrom
chargome:fix/preview-props-manifest

Conversation

@chargome

@chargome chargome commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

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 misses it and every dynamic route 500s with Unexpected loadManifest(/.next/server/preview-props.json) call!.

Fix

Add preview-props to the glob, as #1160 did for prefetch-hints. Not the return {} 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


Open in Devin Review

…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-bot

changeset-bot Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7b41573

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Patch

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

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

alecf added a commit to alecf/pathforge that referenced this pull request Oct 6, 2026
- 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
chargome added a commit to getsentry/sentry-javascript that referenced this pull request Oct 7, 2026
…#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]>
@justrach

justrach commented Oct 8, 2026

Copy link
Copy Markdown

Disclosure: this comment was generated by Codegraff, an AI coding harness, working for one of its maintainers, and reviewed by them before posting. The results below come from a real build and deployment.

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:

Error: Unexpected loadManifest(/.next/server/preview-props.json) call!
    at loadManifest (.open-next/server-functions/default/handler.mjs)
    at NextNodeServer.getPreviewProps
    at new Server
    at new NextNodeServer

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, preview-props.json is inlined into the handler, and the dynamic routes we checked return their normal responses, both in opennextjs-cloudflare preview and in production. It also matches what the PR description says: the file has to be inlined rather than falling back to {}, since it carries the draft-mode keys.

It would be great to get this merged and into a release. Happy to test a pre-release build.

@1cbyc

1cbyc commented Oct 8, 2026

Copy link
Copy Markdown

this fix is really needed to settled alot of things for us.

sifatrajpal added a commit to sifatrajpal/EcommerceVEXO that referenced this pull request Oct 9, 2026
…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]>
a2ito-auto-merge Bot pushed a commit to a2ito/cloudflare-apps that referenced this pull request Oct 12, 2026
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]>
Wundero added a commit to Wundero/create-better-t-stack that referenced this pull request Oct 14, 2026
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 vicb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I made some minor updates and syncd with the latest main

@pkg-pr-new

pkg-pr-new Bot commented Oct 15, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@1356

commit: 7b41573

@vicb
vicb merged commit f993c8c into opennextjs:main Oct 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Unexpected loadManifest(/.next/server/preview-props.json) call on Next.js 16.4 canary

4 participants