You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update dependency @opennextjs/cloudflare to v1.20.20 - #14
Serve the 404 page for the paths that a fallback: false route does not prerender with a basePath.
Run Server Actions forwarded to a dynamic route.
Keep the use cache, fetch and unstable_cache entries during an ISR revalidation (including with Next.js 16.5).
#1525002974d Thanks @ahmed-abdelkafi! - fix: serve the current version when skew protection receives a deployment id such as constructor
Requests with a deployment id such as constructor or toString failed with "TypeError: version.split is not a function" instead of being served the current version.
#1511499bba2 Thanks @vicb! - fix: run Server Actions forwarded to a dynamic route
A Server Action posted to a page that does not bundle it (i.e. called from an effect cleanup after a client navigation) is forwarded by Next to the page that does. Since 1.20.16, it failed with "Failed to find Server Action" when that page is a dynamic route (i.e. /items/[id]/edit). The action now runs, including for catch-all routes, routes with dynamicParams = false and apps with trailingSlash: true.
Middleware sees _forwarded-action in the dynamic segments of the forwarded request, where Next.js passes the route pattern (i.e. [id]).
#12761dcae40 Thanks @spokodev! - fix: ignore repeated initOpenNextCloudflareForDev calls with a warning
Calling initOpenNextCloudflareForDev more than once in the Next.js config file made next dev crash with SQLite failed; database is locked: SQLITE_BUSY and The Workers runtime failed to start. Only the first call is now used, subsequent calls log a warning and are ignored.
#1533ddf6463 Thanks @vicb! - fix: keep the fetch and unstable_cache entries during an ISR revalidation with Next.js 16.5
Next.js 16.5 moved the on-demand revalidation check from the fetch and unstable_cache call sites to IncrementalCache#get, so every ISR revalidation regenerated those entries.
The patchIncrementalCacheForISR patch from @opennextjs/aws 4.2.2 is now applied to the server bundle.
#1533ddf6463 Thanks @vicb! - fix: do not load functions-config-manifest.json at runtime with Next.js 16.5
Next.js 16.5 moved the dynamic require of functions-config-manifest.json to the new NextNodeServer#getMiddlewareConfig, which the adapter did not patch.
Every request of an app without an edge middleware failed with a 500:
Error: Dynamic require of "/.next/server/functions-config-manifest.json" is not supported
The method is now stubbed, like loadNodeMiddleware. The middleware still runs, outside of the Next.js server.
#1533ddf6463 Thanks @vicb! - fix: load the chunks of dynamic import()s with Next.js 16.5 and Turbopack
The Turbopack runtime of Next.js 16.5 declares its own requireChunk, which installs the module factories of the chunk.
The function generated by the adapter to inline the chunks had the same name and shadowed it, so every module loaded through a dynamic import() (e.g. in instrumentation.ts) failed with:
Module <id> was instantiated because it was required from module <id>, but the module factory is not available.
The generated function is now named requireInlinedChunk.
#1533ddf6463 Thanks @vicb! - fix: patch the Turbopack wasm helpers that Next.js 16.5 emits in the chunks
Next.js 16.5 emits the wasm helpers (compileModule and instantiate) as anonymous function expressions instead of function declarations.
The patch silently stopped matching, so apps loading wasm with Turbopack (e.g. Prisma 7) failed at runtime with:
TypeError: WebAssembly.compileStreaming is not a function
The patch now replaces the body of the helpers, whatever form they are emitted in.
Since Next.js 15.3, <Head> tags rendered by a dependency (e.g. the <title>, canonical and og: tags from next-seo) were missing from the HTML of pages rendered by the Worker, such as getServerSideProps pages and ISR fallback paths. Pages pre-rendered at build time were not affected.
The build failed when the app used a package loading a Node.js native addon, e.g. ssh2 (through cpu-features), even when the addon is optional. The error was No loader is configured for ".node" files, or Could not resolve "../build/Release/cpufeatures.node" when the addon was not built (e.g. pnpm skipping the install scripts).
Native addons can not run on Workers. They are now replaced with a module throwing a MODULE_NOT_FOUND error, so packages treating the addon as optional work as if it was not installed. A warning lists each stubbed addon during the build: packages that require the addon fail at runtime.
#1502dbe786f Thanks @haranishi! - fix: warn when the local revalidation queue is missing its service binding
Do not skip the middleware and the next.config routes for some requests of an app using i18n.
Require a path separator after the buildId in /_next/data requests.
Respond with a 500 when the body stream errors before its first chunk.
Match the middleware against the normalized pathname.
#1519db1bd1c Thanks @ahmed-abdelkafi! - fix: validate tagCache instead of incrementalCache when checking for a custom tag cache
A hand-written open-next.config.ts with a custom tagCache and incrementalCache: "dummy" was wrongly rejected with "The open-next.config.ts should have a default export like this".
#1507cc95230 Thanks @vicb! - fix: answer requests with a Cookie header in the Node.js middleware
Since 1.20.18, with a proxy.ts (or a Node.js runtime middleware.ts), every request with a Cookie header answered 500 with TypeError: Cannot read properties of undefined (reading 'parse').
The @opennextjs/aws files were no longer bundled as ES modules, and the default import of cookie@1 was undefined.
#1517226a45f Thanks @vicb! - fix: do not serve stale entries from the regional cache after revalidateTag
With the regional cache (withRegionalCache) and bypassTagCacheOnCacheHit (set explicitly, or the default on Next.js < 16 when cache purge is enabled), a page revalidated with revalidateTag could keep being served stale until its regional cache entry expired or was purged. This happened on almost every revalidation with enableCacheInterception.
Honor dangerous.disableTagCache when reading "use cache" entries.
Queue one revalidation per stale cache entry.
Add an experimental onTagCacheResult callback to entries returned by the incremental cache.
#1492c41442b Thanks @jorgemoya! - perf: read each tag once per request in the sharded Durable Object tag cache
With doShardedTagCache, cached pages could take up to about a second longer to render, mostly on low-traffic sites. Every cached fetch or "use cache" entry on a page checked its tags separately, so the same tags were read from the Durable Objects many times per render.
Each tag is now read once per request, which cuts Durable Object reads, and their cost, on pages with many cached entries.
When experimental.inlineCss is enabled, the same stylesheet can repeat across client reference manifests. OpenNext shares repeated inline CSS strings in the Worker bundle, reducing upload size.
--env="" is how Wrangler recommends targeting the top-level environment when the configuration also defines named environments. The flag was dropped before reaching Wrangler, so the command behaved as if no environment had been specified: the "Multiple environments are defined in the Wrangler configuration file" warning persisted and, when CLOUDFLARE_ENV was set, Wrangler targeted that environment instead of the top-level one.
The empty environment is now forwarded to every Wrangler command, including the ones used to populate the cache.
opennextjs-cloudflare build imports esbuild, but the package only listed it in its devDependencies. The import resolved only when the package manager happened to hoist the copy installed by @opennextjs/aws or wrangler. When another package claimed that slot, or with npm ci on a lockfile marking esbuild as extraneous, the build failed with ERR_MODULE_NOT_FOUND: Cannot find package 'esbuild'.
esbuild is now a dependency, pinned to the version @opennextjs/aws uses.
require.resolve("@opennextjs/cloudflare/package.json") threw MODULE_NOT_FOUND because the ./* export mapped it to a file that does not exist. Tools that read dependency manifests reported the package as missing, for example Storybook printed WARN unable to find package.json for @opennextjs/cloudflare.
The CLI now starts help and version commands without loading Wrangler and Miniflare. Commands that use Wrangler still load it when they read configuration, get bindings, or start an R2 cache worker.
Projects compiled with skipLibCheck: false failed to type-check with errors inside node_modules/wrangler and node_modules/miniflare (e.g. TS2307: Cannot find module '@cloudflare/workers-utils'). The adapter's declarations imported GetPlatformProxyOptions from wrangler, which pulled in wrangler's own declarations, and those do not type-check (cloudflare/workers-sdk#15940). The options of initOpenNextCloudflareForDev are now declared in the adapter, so its declarations no longer reference wrangler.
#1489f5a2d09 Thanks @vicb! - fix: reduce the Node.js middleware (proxy.ts) bundle size and resolve its packages like the server
A proxy.ts (or a middleware.ts using the Node.js runtime) produced a much larger Worker than the same code in an edge middleware.ts (#1373). With Next.js 16.4, the middleware bundle of a proxy only using next/server is now ~40% smaller. A proxy importing React (directly or through a library like next/og) still bundles the Next.js app page runtime.
It also fixes these build errors:
Could not resolve "#util" (and similar) when instrumentation.ts imports a package with conditional imports (#1401). The instrumentation hook is no longer bundled in the middleware.
Could not resolve "cloudflare:sockets" when the middleware imports a package whose workerd build uses cloudflare:* modules, i.e. postgres 4 (#1487).
The esbuild metafile is now written to .open-next/middleware/handler.mjs.meta.json to help analyze the bundle size.
Payload 3.x (payload/dist/bin/loadEnv.js) imports @next/env with a default import, so bundling a Payload app failed with:
No matching export in ".open-next/cloudflare-templates/shims/env.js" for import "default"
The shim now has a default export, and loadEnvConfig returns the same shape as @next/env ({ combinedEnv, parsedEnv, loadedEnvFiles }) so callers destructuring the result no longer throw.
It still does not load any file: process.env is populated at runtime from the Worker bindings and the .env* files compiled at build time for the NEXTJS_ENV mode.
#150468fc728 Thanks @vicb! - chore: warn at build time when Cache Components are enabled
Cache Components (cacheComponents: true in next.config) are not fully supported on Cloudflare yet. Apps that enable them now get a build warning linking to #1318, where support is being tracked.
Match fallback: false routes against the decoded pathname.
Do not expose more Next.js internal headers on the middleware response.
Send the time of entries made stale by a tag to the revalidation queue.
Do not copy next.config headers onto the request headers.
Strip the internal next-resume header from incoming requests.
#1479223f07f Thanks @vicb! - fix: do not serve /cdn-cgi/image/ for revalidation requests sent through WORKER_SELF_REFERENCE
#14272d4665a Thanks @jkugsiya! - fix: stop the Durable Object queue from revalidating routes again after every restart
Once a revalidation had failed, the Durable Object queue revalidated the route again every time it restarted, even after the retry succeeded or the queue gave up. The number of extra revalidations grew until the next deployment. The queue now forgets a route once it stops retrying it.
#1486843723c Thanks @vicb! - fix: leave cloudflare:* imports external in the server bundle
postgres 4 maps its Workers build (src/cf.js) to the workerd condition, and that build imports cloudflare:sockets statically. With postgres 4 in serverExternalPackages, the build failed while bundling the server with:
✘ [ERROR] Could not resolve "cloudflare:sockets"
cloudflare:* imports are now left to wrangler, as node:* imports already are, so postgres 4 uses cloudflare:sockets in the Worker.
#14417d97fe8 Thanks @mathurshubham! - fix: stop the Durable Object queue from skipping ISR revalidations until the next deployment
With the Durable Object queue, some ISR pages stayed x-nextjs-cache: STALE until the next deployment:
pages that took more than about a second to revalidate,
pages made stale by revalidateTag after their first revalidation.
These pages are now revalidated.
#1434e476844 Thanks @mathurshubham! - fix: re-arm the bucket cache purge alarm when the stored alarm is in the past
Affects apps using purgeCache({ type: "durableObject" }) (the NEXT_CACHE_DO_PURGE binding).
Once the purge alarm had exhausted its retries (for example after the Wrong number of parameter bindings error fixed in #1289, or a purge rate limit), the Durable Object never scheduled another alarm. Every later revalidateTag / revalidatePath queued its tags but the CDN cache was never purged and pages stayed stale.
The alarm is now re-armed when it is in the past. After upgrading, the next revalidation purges the queued tags without having to reset the Durable Object. See #929
#14318d30187 Thanks @kremnyi! - fix: retry all the failed revalidations of the Durable Object queue
When three or more failed ISR revalidations were waiting to be retried at the same time with the Durable Object queue (DOQueueHandler), only some of them were retried. The routes that were not retried stayed marked as failed, so later ISR requests for these routes did not trigger a revalidation either. These pages stayed stale until another revalidation failed or the Durable Object restarted.
All the failed revalidations are now retried.
#1484b6ccf33 Thanks @vicb! - fix: resolve the workerd build of packages from the installed node_modules instead of copying it
Next.js traces the packages it does not bundle with the Node.js conditions, so the files only used by the workerd build of a package are missing from .open-next. They used to be copied, along with the dependencies of the workerd build, but a dependency that Next.js had partially traced for another package was left incomplete. With serverExternalPackages: ["@sentry/nextjs"], 1.20.15 and 1.20.16 failed with:
✘ [ERROR] Could not resolve "@sentry/server-utils/no-diagnostic-channels"
Nothing is copied anymore. The server bundle resolves the packages with a workerd condition from the installed node_modules (the workerd condition wins over the Node.js ones) and uses the traced copy of a file when there is one, so that each module is bundled once. The files that were not traced are read from node_modules.
#14776fa9898 Thanks @vicb! - fix: serve public files like Next.js when run_worker_first is enabled
Public files are now only served at their exact path when run_worker_first is enabled, like Next.js.
The build now checks the assets configuration when run_worker_first is enabled. If the build fails with "When run_worker_first is enabled, the assets section of the wrangler configuration must be...", update the assets section of your wrangler configuration:
{
"assets": {
"directory": ".open-next/assets",
"binding": "ASSETS",
"run_worker_first": true,
// Serve public files at their exact path only, like Next.js"html_handling": "none",
// "404-page" is also allowed"not_found_handling": "none",
},
}
With this configuration, public/about.html is served at /about.html but not at /about.
Fix the build-time fetch cache being ignored when deploymentId is set.
Fix res.revalidate() in Pages Router API routes on Next 15.4+, pages are now revalidated in-process.
Fix pages rendered on demand being reported as stale one second after they were written.
Fix entries marked stale by revalidateTag(tag, "max") not being served with stale-while-revalidate on Next 16.4+.
#1449d280ba4 Thanks @vicb! - fix: invalidate CDN cache tags through the Cloudflare invalidation handler
On-demand revalidation now purges Cloudflare cache tags through OpenNext's centralized CDN invalidation flow instead of coupling purges to the built-in tag-cache implementations.
The purge type is now honored for every invalidation. Previously, revalidateTag used the NEXT_CACHE_DO_PURGE Durable Object whenever it was bound and otherwise called the Cloudflare API directly, regardless of type.
Direct invalidation now rejects unsuccessful API outcomes. In Durable Object mode, a missing NEXT_CACHE_DO_PURGE binding now logs an error and skips the purge for both tag and path invalidation. revalidateTag no longer falls back to unbuffered direct purges, which count against the account-wide purge rate limit. Add the binding to restore CDN purges.
When cache purge is configured without CACHE_PURGE_ZONE_ID or CACHE_PURGE_API_TOKEN, on-demand revalidation still updates the tag cache, but the purge is now reported as a failed CDN invalidation (Cloudflare cache purge failed: missing-credentials) rather than a skipped purge. Set both variables, or remove the cdnInvalidation override if CDN purging is not needed.
Custom Durable Objects can extend BucketCachePurgeBase and override its protected storage, batching, execution, and settlement hooks to support alternate schemas while retaining alarm scheduling and queue draining. The concrete BucketCachePurge class preserves the default single-zone behavior.
#14296026fed Thanks @mathurshubham! - fix: copy the workerd build of every traced package, not only of serverExternalPackages
The Cloudflare build of a package exposed through the workerd export condition was only included for packages listed in serverExternalPackages. Packages that Next.js keeps external on its own, and their dependencies, were missing it.
For example, building a Next.js 16 app using pg or @prisma/adapter-pg (the Hyperdrive setup) with Turbopack failed with:
✘ [ERROR] Could not resolve "pg-cloudflare"
The module "./dist/index.js" was not found on the file system
The workerd build of every package is now used, so pg builds without outputFileTracingIncludes workarounds. A package with a workerd condition now always uses that build, even when it is not listed in serverExternalPackages.
#14308a9be4e Thanks @rishabhvenu! - fix: bundle the Node.js middleware (proxy.ts) when @opentelemetry/api is installed
Since 1.20.3, opennextjs-cloudflare build failed with Could not resolve "@opentelemetry/api" for apps with a Node.js middleware and @opentelemetry/api installed, for example as a dependency of @sentry/nextjs.
#1473cf1e5b9 Thanks @vicb! - fix: use the Open Next build id for the Durable Objects and drop the unused cache assets SQL manifest
The Durable Objects now use getOpenNextBuildId() from @opennextjs/aws, so an empty deploymentId falls back to the build id. The queue Durable Object now clears the state of previous builds in that case.
.open-next/cloudflare/cache-assets-manifest.sql is no longer generated. It seeded the D1 tag cache used before 1.0 and no current tag cache reads it.
#13327fe40aa Thanks @yuanzhixiang! - fix: support a custom buildOutputPath in the deploy, preview, upload and populateCache commands
With buildOutputPath set in open-next.config.ts, these commands failed right after a successful build with Could not find compiled Open Next config, did you run the build command?. They now find the build output under the configured buildOutputPath.
#1438803d221 Thanks @mathurshubham! - fix: resolve Turbopack hashed externals through their symlink under pnpm
With Turbopack and pnpm, packages listed in serverExternalPackages were bundled using their Node.js
build instead of their workerd build. For example postgres was bundled without cloudflare:sockets
support and failed at runtime.
The workerd build is now used. This also fixes externals that are not direct dependencies of the app,
and npm aliases.
#13327fe40aa Thanks @yuanzhixiang! - fix: find @vercel/og in the app node_modules when a custom buildOutputPath is set
When .next was in buildOutputPath and node_modules next to the app, the build failed with ENOENT: no such file or directory, copyfile '.../next/dist/compiled/@vercel/og/index.edge.js'.
The inlined manifests were re-created on every load, so apps with large manifests (e.g. the prerender manifest) spent CPU time building and garbage collecting the same objects and kept multiple copies in memory.
#14707460f53 Thanks @vicb! - fix: scope the module-loading signal to the request on Next 16
Starting with Next.js 16, the module-loading patch silently stopped matching the changed CacheSignal constructor. Concurrent requests could then fail with Cannot perform I/O on behalf of a different request and return truncated responses. Scope the signal to each request again so concurrent renders complete.
Fix Next.js 15 builds failing with "Next.js version 15.x.x is not supported by the Next.js team" now that Next.js 15 is 2 years old. A major version stays supported until the second next major (Next.js 17) is released.
#14391ebbc55 Thanks @mathurshubham! - fix: inline named webpack chunks (webpackChunkName) in the server runtime
Apps built with webpack returned a 500 with Error: Unknown chunk N when the server code loaded a chunk named with /* webpackChunkName: "..." */, i.e. from a next/dynamic or import() in the app or in a dependency. Named chunks are now bundled into the Worker and load correctly.
#14198327c21 Thanks @Adnan-Husayn! - fix: set the image Content-Type from the format produced by the Images binding
The Images binding can fall back to another format than the requested one, i.e. from AVIF to WebP for large images. /_next/image responses were labelled with the requested format, so the Content-Type could disagree with the image bytes.
opennextjs-cloudflare build no longer fails with EISDIR or an unresolved import when an App Router route directory matches an internal manifest glob. Only manifest files are now inlined.
#1423a515128 Thanks @Adnan-Husayn! - fix: do not log Failed to copy for packages whose exports is a string
Prevent Next.js 15.4 and newer Cache Components from failing under concurrent traffic with Cannot perform I/O on behalf of a different request when module-loading timers cross Cloudflare Worker request contexts.
Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.
♻ Renovate will retry this branch, including artifacts, only when one of the following happens:
any of the package files in this branch needs updating, or
the branch becomes conflicted, or
you click the rebase/retry checkbox if found above, or
you rename this PR's title to start with "rebase!" to trigger it manually
The artifact failure details are included below:
File name: package-lock.json
npm warn Unknown env config "store". This will error in a future major version of npm. See `npm help npmrc` for supported config options.
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: web4@undefined
npm error Found: next@15.4.5
npm error node_modules/next
npm error next@"15.4.5" from the root project
npm error
npm error Could not resolve dependency:
npm error peer next@">=15.5.29 <16 || >=16.4.5" from @opennextjs/cloudflare@1.20.20
npm error node_modules/@opennextjs/cloudflare
npm error @opennextjs/cloudflare@"1.20.20" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry this command with --force or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error /runner/cache/others/npm/_logs/2026-12-04T17_09_13_703Z-eresolve-report.txt
npm error A complete log of this run can be found in: /runner/cache/others/npm/_logs/2026-12-04T17_09_13_703Z-debug-0.log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
1.3.1→1.20.20Release Notes
opennextjs/opennextjs-cloudflare (@opennextjs/cloudflare)
v1.20.20Compare Source
Patch Changes
#1535
6abad6aThanks @vicb! - chore: bump@opennextjs/awsto 4.2.2See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.2.2
redirectsandheaderscase-insensitively.fallback: falseroute does not prerender with abasePath.use cache,fetchandunstable_cacheentries during an ISR revalidation (including with Next.js 16.5).#1525
002974dThanks @ahmed-abdelkafi! - fix: serve the current version when skew protection receives a deployment id such asconstructorRequests with a deployment id such as
constructorortoStringfailed with "TypeError: version.split is not a function" instead of being served the current version.#1511
499bba2Thanks @vicb! - fix: run Server Actions forwarded to a dynamic routeA Server Action posted to a page that does not bundle it (i.e. called from an effect cleanup after a client navigation) is forwarded by Next to the page that does. Since 1.20.16, it failed with "Failed to find Server Action" when that page is a dynamic route (i.e.
/items/[id]/edit). The action now runs, including for catch-all routes, routes withdynamicParams = falseand apps withtrailingSlash: true.Middleware sees
_forwarded-actionin the dynamic segments of the forwarded request, where Next.js passes the route pattern (i.e.[id]).#1276
1dcae40Thanks @spokodev! - fix: ignore repeatedinitOpenNextCloudflareForDevcalls with a warningCalling
initOpenNextCloudflareForDevmore than once in the Next.js config file madenext devcrash withSQLite failed; database is locked: SQLITE_BUSYandThe Workers runtime failed to start. Only the first call is now used, subsequent calls log a warning and are ignored.#1533
ddf6463Thanks @vicb! - fix: keep thefetchandunstable_cacheentries during an ISR revalidation with Next.js 16.5Next.js 16.5 moved the on-demand revalidation check from the
fetchandunstable_cachecall sites toIncrementalCache#get, so every ISR revalidation regenerated those entries.The
patchIncrementalCacheForISRpatch from@opennextjs/aws4.2.2 is now applied to the server bundle.See opennextjs/opennextjs-aws#1384 and opennextjs/opennextjs-aws#1385.
#1533
ddf6463Thanks @vicb! - fix: do not loadfunctions-config-manifest.jsonat runtime with Next.js 16.5Next.js 16.5 moved the dynamic
requireoffunctions-config-manifest.jsonto the newNextNodeServer#getMiddlewareConfig, which the adapter did not patch.Every request of an app without an edge middleware failed with a 500:
The method is now stubbed, like
loadNodeMiddleware. The middleware still runs, outside of the Next.js server.#1533
ddf6463Thanks @vicb! - fix: load the chunks of dynamicimport()s with Next.js 16.5 and TurbopackThe Turbopack runtime of Next.js 16.5 declares its own
requireChunk, which installs the module factories of the chunk.The function generated by the adapter to inline the chunks had the same name and shadowed it, so every module loaded through a dynamic
import()(e.g. ininstrumentation.ts) failed with:The generated function is now named
requireInlinedChunk.#1533
ddf6463Thanks @vicb! - fix: patch the Turbopack wasm helpers that Next.js 16.5 emits in the chunksNext.js 16.5 emits the wasm helpers (
compileModuleandinstantiate) as anonymous function expressions instead of function declarations.The patch silently stopped matching, so apps loading wasm with Turbopack (e.g. Prisma 7) failed at runtime with:
The patch now replaces the body of the helpers, whatever form they are emitted in.
#1440
873d2b9Thanks @mathurshubham! - fix: render<Head>tags from dependencies likenext-seoSince Next.js 15.3,
<Head>tags rendered by a dependency (e.g. the<title>, canonical andog:tags fromnext-seo) were missing from the HTML of pages rendered by the Worker, such asgetServerSidePropspages and ISR fallback paths. Pages pre-rendered at build time were not affected.#1529
3cd810bThanks @ahmed-abdelkafi! - fix: accept the.workers.devsuffix forCF_PREVIEW_DOMAIN#1433
80addb0Thanks @mathurshubham! - fix: support packages with optional native addonsThe build failed when the app used a package loading a Node.js native addon, e.g.
ssh2(throughcpu-features), even when the addon is optional. The error wasNo loader is configured for ".node" files, orCould not resolve "../build/Release/cpufeatures.node"when the addon was not built (e.g. pnpm skipping the install scripts).Native addons can not run on Workers. They are now replaced with a module throwing a
MODULE_NOT_FOUNDerror, so packages treating the addon as optional work as if it was not installed. A warning lists each stubbed addon during the build: packages that require the addon fail at runtime.#1502
dbe786fThanks @haranishi! - fix: warn when the local revalidation queue is missing its service bindingv1.20.19Compare Source
Patch Changes
#1509
e664bacThanks @vicb! - chore: bump glob to v14 to drop the vulnerable minimatch 10 dependencyglob@13depends onminimatch@10, which is affected by GHSA-g3hv-75wg-m249 and has no patched 10.x release.glob@14usesminimatch@11.#1520
5062c28Thanks @vicb! - chore: bump@opennextjs/awsto 4.2.1See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.2.1
next.configroutes for some requests of an app usingi18n./_next/datarequests.#1519
db1bd1cThanks @ahmed-abdelkafi! - fix: validatetagCacheinstead ofincrementalCachewhen checking for a custom tag cacheA hand-written
open-next.config.tswith a customtagCacheandincrementalCache: "dummy"was wrongly rejected with "Theopen-next.config.tsshould have a default export like this".#1507
cc95230Thanks @vicb! - fix: answer requests with aCookieheader in the Node.js middlewareSince 1.20.18, with a
proxy.ts(or a Node.js runtimemiddleware.ts), every request with aCookieheader answered 500 withTypeError: Cannot read properties of undefined (reading 'parse').The
@opennextjs/awsfiles were no longer bundled as ES modules, and the default import ofcookie@1wasundefined.#1517
226a45fThanks @vicb! - fix: do not serve stale entries from the regional cache afterrevalidateTagWith the regional cache (
withRegionalCache) andbypassTagCacheOnCacheHit(set explicitly, or the default on Next.js < 16 when cache purge is enabled), a page revalidated withrevalidateTagcould keep being served stale until its regional cache entry expired or was purged. This happened on almost every revalidation withenableCacheInterception.v1.20.18Compare Source
Patch Changes
#1505
2bc929eThanks @vicb! - chore: bump@opennextjs/awsto 4.2.0See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.2.0
dangerous.disableTagCachewhen reading"use cache"entries.onTagCacheResultcallback to entries returned by the incremental cache.#1492
c41442bThanks @jorgemoya! - perf: read each tag once per request in the sharded Durable Object tag cacheWith
doShardedTagCache, cached pages could take up to about a second longer to render, mostly on low-traffic sites. Every cachedfetchor"use cache"entry on a page checked its tags separately, so the same tags were read from the Durable Objects many times per render.Each tag is now read once per request, which cuts Durable Object reads, and their cost, on pages with many cached entries.
#1498
2fd94f6Thanks @haranishi! - fix: deduplicate inline CSS in the Worker bundleWhen
experimental.inlineCssis enabled, the same stylesheet can repeat across client reference manifests. OpenNext shares repeated inline CSS strings in the Worker bundle, reducing upload size.#1417
3d7a137Thanks @Adnan-Husayn! - fix: forward an empty--envto wrangler--env=""is how Wrangler recommends targeting the top-level environment when the configuration also defines named environments. The flag was dropped before reaching Wrangler, so the command behaved as if no environment had been specified: the "Multiple environments are defined in the Wrangler configuration file" warning persisted and, whenCLOUDFLARE_ENVwas set, Wrangler targeted that environment instead of the top-level one.The empty environment is now forwarded to every Wrangler command, including the ones used to populate the cache.
#1353
780d32cThanks @uttkarsh-26! - fix: declare esbuild as a dependencyopennextjs-cloudflare buildimportsesbuild, but the package only listed it in itsdevDependencies. The import resolved only when the package manager happened to hoist the copy installed by@opennextjs/awsorwrangler. When another package claimed that slot, or withnpm cion a lockfile markingesbuildas extraneous, the build failed withERR_MODULE_NOT_FOUND: Cannot find package 'esbuild'.esbuildis now a dependency, pinned to the version@opennextjs/awsuses.#1432
e751dd8Thanks @mathurshubham! - fix: exportpackage.jsonfrom@opennextjs/cloudflarerequire.resolve("@opennextjs/cloudflare/package.json")threwMODULE_NOT_FOUNDbecause the./*export mapped it to a file that does not exist. Tools that read dependency manifests reported the package as missing, for example Storybook printedWARN unable to find package.json for @opennextjs/cloudflare.#1499
95d7f52Thanks @haranishi! - perf: load Wrangler on demand in the CLIThe CLI now starts help and version commands without loading Wrangler and Miniflare. Commands that use Wrangler still load it when they read configuration, get bindings, or start an R2 cache worker.
#1442
f0efe83Thanks @mathurshubham! - fix: do not importwranglertypes from the public type declarationsProjects compiled with
skipLibCheck: falsefailed to type-check with errors insidenode_modules/wranglerandnode_modules/miniflare(e.g.TS2307: Cannot find module '@cloudflare/workers-utils'). The adapter's declarations importedGetPlatformProxyOptionsfromwrangler, which pulled in wrangler's own declarations, and those do not type-check (cloudflare/workers-sdk#15940). The options ofinitOpenNextCloudflareForDevare now declared in the adapter, so its declarations no longer referencewrangler.#1489
f5a2d09Thanks @vicb! - fix: reduce the Node.js middleware (proxy.ts) bundle size and resolve its packages like the serverA
proxy.ts(or amiddleware.tsusing the Node.js runtime) produced a much larger Worker than the same code in an edgemiddleware.ts(#1373). With Next.js 16.4, the middleware bundle of a proxy only usingnext/serveris now ~40% smaller. A proxy importing React (directly or through a library likenext/og) still bundles the Next.js app page runtime.It also fixes these build errors:
Could not resolve "#util"(and similar) wheninstrumentation.tsimports a package with conditional imports (#1401). The instrumentation hook is no longer bundled in the middleware.Could not resolve "cloudflare:sockets"when the middleware imports a package whoseworkerdbuild usescloudflare:*modules, i.e.postgres4 (#1487).The esbuild metafile is now written to
.open-next/middleware/handler.mjs.meta.jsonto help analyze the bundle size.#1462
dcffe69Thanks @medlabib! - fix: add a default export to the@next/envshimPayload 3.x (
payload/dist/bin/loadEnv.js) imports@next/envwith a default import, so bundling a Payload app failed with:The shim now has a default export, and
loadEnvConfigreturns the same shape as@next/env({ combinedEnv, parsedEnv, loadedEnvFiles }) so callers destructuring the result no longer throw.It still does not load any file:
process.envis populated at runtime from the Worker bindings and the.env*files compiled at build time for theNEXTJS_ENVmode.#1504
68fc728Thanks @vicb! - chore: warn at build time when Cache Components are enabledCache Components (
cacheComponents: trueinnext.config) are not fully supported on Cloudflare yet. Apps that enable them now get a build warning linking to #1318, where support is being tracked.v1.20.17Compare Source
Patch Changes
#1488
e6c6736Thanks @vicb! - chore: bump@opennextjs/awsto 4.1.16See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.16
fallback: falseroutes against the decoded pathname.next.configheaders onto the request headers.next-resumeheader from incoming requests.#1479
223f07fThanks @vicb! - fix: do not serve/cdn-cgi/image/for revalidation requests sent throughWORKER_SELF_REFERENCE#1427
2d4665aThanks @jkugsiya! - fix: stop the Durable Object queue from revalidating routes again after every restartOnce a revalidation had failed, the Durable Object queue revalidated the route again every time it restarted, even after the retry succeeded or the queue gave up. The number of extra revalidations grew until the next deployment. The queue now forgets a route once it stops retrying it.
#1486
843723cThanks @vicb! - fix: leavecloudflare:*imports external in the server bundlepostgres4 maps its Workers build (src/cf.js) to theworkerdcondition, and that build importscloudflare:socketsstatically. Withpostgres4 inserverExternalPackages, the build failed while bundling the server with:cloudflare:*imports are now left to wrangler, asnode:*imports already are, sopostgres4 usescloudflare:socketsin the Worker.#1441
7d97fe8Thanks @mathurshubham! - fix: stop the Durable Object queue from skipping ISR revalidations until the next deploymentWith the Durable Object queue, some ISR pages stayed
x-nextjs-cache: STALEuntil the next deployment:revalidateTagafter their first revalidation.These pages are now revalidated.
#1434
e476844Thanks @mathurshubham! - fix: re-arm the bucket cache purge alarm when the stored alarm is in the pastAffects apps using
purgeCache({ type: "durableObject" })(theNEXT_CACHE_DO_PURGEbinding).Once the purge alarm had exhausted its retries (for example after the
Wrong number of parameter bindingserror fixed in #1289, or a purge rate limit), the Durable Object never scheduled another alarm. Every laterrevalidateTag/revalidatePathqueued its tags but the CDN cache was never purged and pages stayed stale.The alarm is now re-armed when it is in the past. After upgrading, the next revalidation purges the queued tags without having to reset the Durable Object. See #929
#1431
8d30187Thanks @kremnyi! - fix: retry all the failed revalidations of the Durable Object queueWhen three or more failed ISR revalidations were waiting to be retried at the same time with the Durable Object queue (
DOQueueHandler), only some of them were retried. The routes that were not retried stayed marked as failed, so later ISR requests for these routes did not trigger a revalidation either. These pages stayed stale until another revalidation failed or the Durable Object restarted.All the failed revalidations are now retried.
#1484
b6ccf33Thanks @vicb! - fix: resolve theworkerdbuild of packages from the installednode_modulesinstead of copying itNext.js traces the packages it does not bundle with the Node.js conditions, so the files only used by the
workerdbuild of a package are missing from.open-next. They used to be copied, along with the dependencies of theworkerdbuild, but a dependency that Next.js had partially traced for another package was left incomplete. WithserverExternalPackages: ["@sentry/nextjs"], 1.20.15 and 1.20.16 failed with:Nothing is copied anymore. The server bundle resolves the packages with a
workerdcondition from the installednode_modules(theworkerdcondition wins over the Node.js ones) and uses the traced copy of a file when there is one, so that each module is bundled once. The files that were not traced are read fromnode_modules.v1.20.16Compare Source
Patch Changes
#1477
6fa9898Thanks @vicb! - fix: serve public files like Next.js whenrun_worker_firstis enabledPublic files are now only served at their exact path when
run_worker_firstis enabled, like Next.js.The build now checks the
assetsconfiguration whenrun_worker_firstis enabled. If the build fails with "Whenrun_worker_firstis enabled, theassetssection of the wrangler configuration must be...", update theassetssection of your wrangler configuration:{ "assets": { "directory": ".open-next/assets", "binding": "ASSETS", "run_worker_first": true, // Serve public files at their exact path only, like Next.js "html_handling": "none", // "404-page" is also allowed "not_found_handling": "none", }, }With this configuration,
public/about.htmlis served at/about.htmlbut not at/about.#1476
750d1b7Thanks @vicb! - chore: bump@opennextjs/awsto 4.1.15See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.15
#1477
dbeff84Thanks @vicb! - fix: false-positive AVIF/HEIC image type detectionThe AVIF and HEIC detection now validates the size of the ISOBMFF
ftypbox.#1474
5c429e7Thanks @vicb! - chore: require Next.js 15.5.29 or 16.4.5Raise the supported Next.js version floor to 15.5.29 and 16.4.5 to include the fixes from
the Next.js security release on Nov 3.
#1477
0c7e3e6Thanks @vicb! - fix: encode cache keys in the static assets incremental cache and the regional cacheCache keys are now encoded when they are turned into URLs, so that a key can not resolve to the entry of a different key.
v1.20.15Compare Source
Patch Changes
#1473
cf1e5b9Thanks @vicb! - chore: bump@opennextjs/awsto 4.1.14See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.14
deploymentIdis set.res.revalidate()in Pages Router API routes on Next 15.4+, pages are now revalidated in-process.revalidateTag(tag, "max")not being served with stale-while-revalidate on Next 16.4+.#1449
d280ba4Thanks @vicb! - fix: invalidate CDN cache tags through the Cloudflare invalidation handlerOn-demand revalidation now purges Cloudflare cache tags through OpenNext's centralized CDN invalidation flow instead of coupling purges to the built-in tag-cache implementations.
The purge
typeis now honored for every invalidation. Previously,revalidateTagused theNEXT_CACHE_DO_PURGEDurable Object whenever it was bound and otherwise called the Cloudflare API directly, regardless oftype.Direct invalidation now rejects unsuccessful API outcomes. In Durable Object mode, a missing
NEXT_CACHE_DO_PURGEbinding now logs an error and skips the purge for both tag and path invalidation.revalidateTagno longer falls back to unbuffered direct purges, which count against the account-wide purge rate limit. Add the binding to restore CDN purges.When cache purge is configured without
CACHE_PURGE_ZONE_IDorCACHE_PURGE_API_TOKEN, on-demand revalidation still updates the tag cache, but the purge is now reported as a failed CDN invalidation (Cloudflare cache purge failed: missing-credentials) rather than a skipped purge. Set both variables, or remove thecdnInvalidationoverride if CDN purging is not needed.Custom Durable Objects can extend
BucketCachePurgeBaseand override its protected storage, batching, execution, and settlement hooks to support alternate schemas while retaining alarm scheduling and queue draining. The concreteBucketCachePurgeclass preserves the default single-zone behavior.#1429
6026fedThanks @mathurshubham! - fix: copy the workerd build of every traced package, not only ofserverExternalPackagesThe Cloudflare build of a package exposed through the
workerdexport condition was only included for packages listed inserverExternalPackages. Packages that Next.js keeps external on its own, and their dependencies, were missing it.For example, building a Next.js 16 app using
pgor@prisma/adapter-pg(the Hyperdrive setup) with Turbopack failed with:The
workerdbuild of every package is now used, sopgbuilds withoutoutputFileTracingIncludesworkarounds. A package with aworkerdcondition now always uses that build, even when it is not listed inserverExternalPackages.#1430
8a9be4eThanks @rishabhvenu! - fix: bundle the Node.js middleware (proxy.ts) when@opentelemetry/apiis installedSince 1.20.3,
opennextjs-cloudflare buildfailed withCould not resolve "@opentelemetry/api"for apps with a Node.js middleware and@opentelemetry/apiinstalled, for example as a dependency of@sentry/nextjs.#1473
cf1e5b9Thanks @vicb! - fix: use the Open Next build id for the Durable Objects and drop the unused cache assets SQL manifestgetOpenNextBuildId()from@opennextjs/aws, so an emptydeploymentIdfalls back to the build id. The queue Durable Object now clears the state of previous builds in that case..open-next/cloudflare/cache-assets-manifest.sqlis no longer generated. It seeded the D1 tag cache used before 1.0 and no current tag cache reads it.#1332
7fe40aaThanks @yuanzhixiang! - fix: support a custombuildOutputPathin thedeploy,preview,uploadandpopulateCachecommandsWith
buildOutputPathset inopen-next.config.ts, these commands failed right after a successful build withCould not find compiled Open Next config, did you run the build command?. They now find the build output under the configuredbuildOutputPath.#1438
803d221Thanks @mathurshubham! - fix: resolve Turbopack hashed externals through their symlink under pnpmWith Turbopack and pnpm, packages listed in
serverExternalPackageswere bundled using their Node.jsbuild instead of their
workerdbuild. For examplepostgreswas bundled withoutcloudflare:socketssupport and failed at runtime.
The
workerdbuild is now used. This also fixes externals that are not direct dependencies of the app,and npm aliases.
#1332
7fe40aaThanks @yuanzhixiang! - fix: find@vercel/ogin the appnode_moduleswhen a custombuildOutputPathis setWhen
.nextwas inbuildOutputPathandnode_modulesnext to the app, the build failed withENOENT: no such file or directory, copyfile '.../next/dist/compiled/@vercel/og/index.edge.js'.v1.20.14Compare Source
Patch Changes
#1470
7460f53Thanks @vicb! - chore: bump@opennextjs/awsto 4.1.13See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.13
@opennextjs/aws/build/patch/testUtils.js#1466
3e50371Thanks @NathanDrake2406! - fix: reuse cached manifests to reduce CPU and memory usageThe inlined manifests were re-created on every load, so apps with large manifests (e.g. the prerender manifest) spent CPU time building and garbage collecting the same objects and kept multiple copies in memory.
#1470
7460f53Thanks @vicb! - fix: scope the module-loading signal to the request on Next 16Starting with Next.js 16, the module-loading patch silently stopped matching the changed
CacheSignalconstructor. Concurrent requests could then fail withCannot perform I/O on behalf of a different requestand return truncated responses. Scope the signal to each request again so concurrent renders complete.v1.20.13Compare Source
Patch Changes
#1460
8e60dedThanks @vicb! - chore: bump@opennextjs/awsto 4.1.12See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.12
#1414
15f4c9eThanks @allangreatsoftwares! - fix: render server action redirects for the host of the request#1439
1ebbc55Thanks @mathurshubham! - fix: inline named webpack chunks (webpackChunkName) in the server runtimeApps built with webpack returned a 500 with
Error: Unknown chunk Nwhen the server code loaded a chunk named with/* webpackChunkName: "..." */, i.e. from anext/dynamicorimport()in the app or in a dependency. Named chunks are now bundled into the Worker and load correctly.v1.20.12Compare Source
Patch Changes
#1453
5d8c5bcThanks @vicb! - chore: bump@opennextjs/awsto 4.1.11See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.11
#1356
f993c8cThanks @chargome! - fix(patches): includepreview-props.jsonin loadManifest build-time inliningv1.20.11Compare Source
Patch Changes
#1451
a6893b8Thanks @vicb! - chore: bump@opennextjs/awsto 4.1.10See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.10
#1437
6be5dafThanks @mathurshubham! - fix: do not bundle@vercel/oginto the Node.js middleware when it is not usedv1.20.10Compare Source
Patch Changes
#1426
66b4a2dThanks @vicb! - chore: bump@opennextjs/awsto 4.1.9See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.9
#1419
8327c21Thanks @Adnan-Husayn! - fix: set the imageContent-Typefrom the format produced by the Images bindingThe Images binding can fall back to another format than the requested one, i.e. from AVIF to WebP for large images.
/_next/imageresponses were labelled with the requested format, so theContent-Typecould disagree with the image bytes.#1420
afea1a0Thanks @cpruijsen! - fix: skip route directories matching the loadManifest globsopennextjs-cloudflare buildno longer fails withEISDIRor an unresolved import when an App Router route directory matches an internal manifest glob. Only manifest files are now inlined.#1423
a515128Thanks @Adnan-Husayn! - fix: do not logFailed to copyfor packages whoseexportsis a stringv1.20.9Compare Source
Patch Changes
#1416
63cbeceThanks @vicb! - chore: bump@opennextjs/awsto 4.1.8See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.8
#1416
63cbeceThanks @vicb! - fix: isolate module-loading cache signals between requestsPrevent Next.js 15.4 and newer Cache Components from failing under concurrent traffic with
Cannot perform I/O on behalf of a different requestwhen module-loading timers cross Cloudflare Worker request contexts.v1.20.8[Compare Source]
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.