github opennextjs/opennextjs-cloudflare @opennextjs/cloudflare@1.20.15

4 hours ago

Patch Changes

  • #1473 cf1e5b9 Thanks @vicb! - chore: bump @opennextjs/aws to 4.1.14

    See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v4.1.14

    • 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.

  • #1429 6026fed 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.

  • #1430 8a9be4e 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.

  • #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.

  • #1438 803d221 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.

  • #1332 7fe40aa 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'.

Don't miss a new opennextjs-cloudflare release

NewReleases is sending notifications on new releases.