OpenNext Cloudflare 1.20.18

OpenNext Cloudflare refers to the @opennextjs/cloudflare adapter, which transforms a Next.js application into a format that can run on Cloudflare Workers.

Instead of rewriting your app, it takes the build output and converts it into a Worker-compatible package.

In simple terms:

  • Next.js builds your app

  • OpenNext transforms it

  • Cloudflare Workers runs it globally at the edge

Get Started

New apps

To create a new Next.js app, pre-configured to run on Cloudflare using @opennextjs/cloudflare, run:

npm create cloudflare@latest -- my-next-app --framework=next --platform=workers

Existing Next.js apps

The easiest way to convert an existing Next.js app is to use the migrate command:

npx @opennextjs/cloudflare migrate

This command automates all the setup steps below. If R2 is enabled on your account, it also creates an R2 bucket for caching. See the CLI documentation for more details.

OpenNext Cloudflare 1.20.18 Release Notes

Patch Changes

See details at
  • 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.
  • #1492 c41442b 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.
  • #1489 f5a2d09 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.
  • #1504 68fc728 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 https://github.com/opennextjs/opennextjs-cloudflare/pull/1318, where support is being tracked.

How It Works

The process is straightforward but powerful:

  1. You build your Next.js app normally

  2. OpenNext processes the build output

  3. The adapter converts it into a Worker bundle

  4. You deploy it using Wrangler to Cloudflare

This transformation step is the key innovation, enabling Next.js apps to run outside their native ecosystem.


Key Features of OpenNEXT Cloudflare

1. Full Next.js Feature Support

OpenNext Cloudflare supports most major Next.js features:

  • Server-side rendering (SSR)

  • Static site generation (SSG)

  • Incremental static regeneration (ISR)

  • API routes and middleware

  • App Router and React Server Components

This makes it suitable for real production apps, not just simple sites.


2. Node.js Runtime on Cloudflare Workers

Unlike older approaches, OpenNext uses a Node-compatible runtime inside Workers. This allows broader compatibility with existing Next.js apps.

This is a major advantage over edge-only solutions that restrict APIs.


3. Global Edge Deployment

By using Cloudflare Workers, your app runs close to users worldwide, improving latency and performance.

This is especially useful for:

  • SaaS apps

  • APIs

  • Global websites


4. Advanced Caching with R2

OpenNext integrates with Cloudflare R2 for caching features like ISR, helping reduce rebuild costs and improve response times.


5. Multi-Worker Architecture (Advanced)

You can split your app into multiple Workers for better performance and scalability, although this requires advanced configuration.


Performance and Real-World Behavior

OpenNext Cloudflare delivers strong global performance thanks to edge execution. However, performance depends heavily on caching configuration.

For example:

  • Static assets are served efficiently from CDN

  • Dynamic routes use Workers for SSR

  • Improper caching can increase CPU usage

This means optimization is critical for best results.


Developer Experience

Setting up OpenNext Cloudflare is more complex than traditional deployment.

Typical setup includes:

  • Installing @opennextjs/cloudflare

  • Configuring Wrangler

  • Managing cache and storage

  • Adjusting runtime settings

There is also a key limitation:

  • Edge runtime is not fully supported yet, requiring Node runtime instead

This adds some constraints depending on your app architecture.


Pros and Cons

Pros

  • Deploy Next.js on Cloudflare Workers

  • Avoid vendor lock-in from platforms like Vercel

  • Supports most Next.js features

  • Global edge performance

  • Open source and flexible

Cons

  • Setup complexity is high

  • Requires understanding of Cloudflare ecosystem

  • Some features still evolving

  • Windows support is limited

  • Caching and ISR require careful tuning


OpenNext Cloudflare vs Vercel

While Vercel offers the easiest Next.js deployment, OpenNext Cloudflare provides:

  • More infrastructure control

  • Multi-cloud flexibility

  • Potential cost optimization at scale

However, Vercel still wins in simplicity and developer experience.


Who Should Use OpenNext Cloudflare

This setup is ideal for:

  • Advanced developers and DevOps teams

  • Companies avoiding vendor lock-in

  • Projects needing global edge performance

  • Teams already using Cloudflare ecosystem

It is not ideal for beginners or small projects that need quick deployment.


Final Verdict

OpenNext Cloudflare is a powerful solution that unlocks true portability for Next.js applications on edge infrastructure. It brings together flexibility, performance, and control, but at the cost of complexity.

If you want full control over deployment and global performance, OpenNext Cloudflare is one of the most compelling options available today.

If you want to run Next.js apps on Cloudflare instead of being tied to a single platform, OpenNext Cloudflare is one of the most important solutions today. It combines the flexibility of OpenNext with the global edge infrastructure of Cloudflare.

OpenNext Cloudflare 1.20.18
Free
Software Informations:
Developer:

Operating System:
Framework
Date Added:
2026-11-21T08:07:16.776Z
Categories:

Post a Comment/Report Broken Link: