OpenNext Cloudflare 1.20.15

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.15 Release Notes

Patch Changes

See details at
  • 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+.
  • #1449 d280ba4 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. 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. 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.
  • #1473 cf1e5b9 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.
  • #1332 7fe40aa 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. 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. 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'.

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.15
Free
Software Informations:
Developer:

Operating System:
Framework
Date Added:
2026-10-31T08:07:26.836Z
Categories:

Post a Comment/Report Broken Link: