Skip to content

Latest commit

 

History

History
1570 lines (867 loc) · 96 KB

File metadata and controls

1570 lines (867 loc) · 96 KB

@opennextjs/cloudflare

1.19.4

Patch Changes

  • #1221 a2679bf Thanks @mushan0x0! - Stop bundling @vercel/og (and its ~1.4 MiB resvg.wasm) when the app does not use it.

    Next.js's externalImport helper keeps a dynamic import("next/dist/compiled/@vercel/og/index.edge.js") in the emitted handler even for apps that never use ImageResponse / opengraph-image. Previously this module was marked as external when useOg was false, which left Wrangler to resolve and bundle it — pulling in ~800 KiB of JS plus resvg.wasm and pushing many Workers over the Cloudflare free-tier 3 MiB gzip limit.

    When useOg is false, the edge entry is now aliased to the existing throw.js shim, so the unreachable dynamic import resolves to a tiny module and the real @vercel/og library is no longer pulled into the Worker bundle.

  • #1208 2c5b472 Thanks @edmundhung! - Use OPEN_NEXT_BUILD_ID instead of NEXT_BUILD_ID in the cache keys.

    As of Next 16.2 NEXT_BUILD_ID is a fixed value when deploymentId is set explicitly.

    See opennextjs/opennextjs-aws#1144

  • #1193 1e8d232 Thanks @conico974! - Fix tag cache stale logic

1.19.3

Patch Changes

  • #1215 608893e Thanks @vicb! - Factor large repeated values in manifests

    This reduce the size of the generated code.

  • #1218 f0d0226 Thanks @314systems! - remove process.version override

    Remove process.version / process.versions.node overrides now that unjs/unenv#493 is merged and shipped in unenv@2.0.0-rc.16 (project uses 2.0.0-rc.24)

  • #1199 32594d6 Thanks @SdSadat! - fix(cli): fail fast in non-TTY environments instead of hanging on config-creation prompts

    When open-next.config.ts (or wrangler.(toml|json|jsonc)) is missing, the CLI prompts the user to auto-create it. In non-TTY environments (Cloudflare Workers Builds, Docker, CI) the Enquirer prompt can't read stdin, so the build hangs or fails with a truncated prompt and a cryptic exit code — the user sees ? Missing required open-next.config.ts file, do you want to create one? (Y/n) and then ELIFECYCLE Command failed with exit code 13, with no hint at what to do next.

    Now, in non-interactive environments, both prompts throw an actionable error with the exact template to paste (for open-next.config.ts) or point at the existing --skipWranglerConfigCheck / SKIP_WRANGLER_CONFIG_CHECK escape hatch (for the wrangler config). Interactive behavior is unchanged.

1.19.2

Patch Changes

  • #1207 0958726 Thanks @edmundhung! - bump @opennextjs/aws to 3.10.2

    See details at https://github.com/opennextjs/opennextjs-aws/releases/tag/v3.10.2

  • #1139 79b01b8 Thanks @james-elicx! - Fix Turbopack external module resolution by dynamically discovering external imports at build time.

    When packages are listed in serverExternalPackages, Turbopack externalizes them via externalImport() which uses dynamic await import(id). The bundler (ESBuild) can't statically analyze import(id) with a variable, so these modules aren't included in the worker bundle.

    This patch:

    • Discovers hashed Turbopack external module mappings from .next/node_modules/ symlinks (e.g. shiki-43d062b67f27bbdcshiki)
    • Scans traced chunk files for bare external imports (e.g. externalImport("shiki")) and subpath imports (e.g. shiki/engine/javascript)
    • Generates explicit switch/case entries so the bundler can statically resolve and include these modules
  • #1203 6f02d12 Thanks @314systems! - fix: exclude unsupported Next.js 16 releases from peer dependencies.

    The previous range allowed Next.js 16.0.0 through 16.2.2 without a peer dependency warning because >=16.2.3 was already covered by >=15.5.15.

    The range now explicitly supports Next.js 15.5.15 and above in the 15.x line, and Next.js 16.2.3 and above in the 16.x line.

  • #1200 7820ad0 Thanks @NathanDrake2406! - fix: reuse sharded tag data when filling the regional cache.

    The sharded tag cache miss path already reads tag data from the Durable Object before answering the request. Reuse that fetched data when populating the regional cache so a shard miss does not immediately trigger a second identical Durable Object read.

  • #1206 585795d Thanks @314systems! - fix: regression where getEnvFromPlatformProxy received wrong options type

    This fixes a regression introduced in 32ba91a where getEnvFromPlatformProxy call sites passed OpenNextConfig even though the function expects Wrangler GetPlatformProxyOptions.

    The fix restores the pre-32ba91a argument shape by passing { configPath, environment } from CLI arguments, so env resolution follows the selected Wrangler config/environment.

1.19.1

Patch Changes

1.19.0

Minor Changes

Patch Changes

1.18.1

Patch Changes

  • #1176 2232651 Thanks @conico974! - fix for OG with Next 16.2.2

  • #1166 f89fba1 Thanks @ash1day! - fix: sort .endsWith() checks by path length descending to prevent suffix collisions in dynamic requires

    Routes whose paths are suffixes of other routes (e.g. /test/app vs /) were resolved incorrectly because the shorter path matched first in the generated .endsWith() chain. Sorting by path length descending ensures more specific (longer) paths are always checked first.

    Fixes #1156.

1.18.0

Minor Changes

  • #1159 75f5f0a Thanks @edmundhung! - Use remote dev for R2 cache population

    Using remote dev is not subject to the Cloudflare API rate limit of 1,200 requests per 5 minutes that caused failures for large applications with thousands of prerendered pages.

1.17.3

Patch Changes

  • #1160 161e726 Thanks @matthewvolk! - fix(patches): include prefetch-hints.json in loadManifest build-time inlining

    Next.js 16.2.0 introduced prefetch-hints.json as a new server manifest loaded unconditionally by NextNodeServer.getPrefetchHints(). The file exists in the build output but wasn't matched by the glob pattern *-manifest.json, causing the patched loadManifest() to throw at runtime.

1.17.2

Patch Changes

  • #1151 a143282 Thanks @nathanschram! - fix: handle known optional manifests gracefully in loadManifest/evalManifest patches

    Next.js loads certain manifests with handleMissing: true (returning {} when the file doesn't exist). The adapter's build-time glob scan doesn't find these files when they're conditionally generated, so the patched function threw at runtime, crashing dynamic routes with 500.

    Instead of a blanket catch-all, handle only the specific optional manifests from Next.js route-module.ts:

    • react-loadable-manifest (Turbopack per-route, not all routes have dynamic imports)
    • subresource-integrity-manifest (only when experimental.sri configured)
    • server-reference-manifest (App Router only)
    • dynamic-css-manifest (Pages Router + Webpack only)
    • fallback-build-manifest (only for /_error page)
    • prefetch-hints (new in Next.js 16.2)
    • _client-reference-manifest.js (optional for static metadata routes, evalManifest)

    Manifest matching strips .json before comparison since some Next.js constants omit the extension (SUBRESOURCE_INTEGRITY_MANIFEST, DYNAMIC_CSS_MANIFEST, etc.).

    Unknown manifests still throw to surface genuine errors.

    Fixes #1141.

1.17.1

Patch Changes

  • #1147 f5bd138 Thanks @vicb! - make dev /cdn-cgi/image behaves like prod for consistency

1.17.0

Minor Changes

  • #1133 25d5835 Thanks @dario-piotrowicz! - Update the migrate command to attempt to create an R2 bucket for caching, if that is not possible an application without caching enabled will be generated instead.

1.16.6

Patch Changes

  • #1138 4487f1f Thanks @james-elicx! - Fix the CLI potentially setting a future compatibility date in the wrangler config when workerd has published a version matching a future date, by capping to the current date.

1.16.5

Patch Changes

1.16.4

Patch Changes

1.16.3

Patch Changes

1.16.2

Patch Changes

1.16.1

Patch Changes

  • #1100 8676c78 Thanks @vicb! - Empty NextNodeServer#handleNextImageRequest to avoid pulling unneeded deps (in #1098)

1.16.0

Minor Changes

  • #1083 b062597 Thanks @dario-piotrowicz! - feature: add migrate command to set up OpenNext for Cloudflare adapter

    This command helps users migrate existing Next.js applications to the OpenNext Cloudflare adapter by automatically setting up all necessary configuration files, dependencies, and scripts.

    To use the command simply run: npx opennextjs-cloudflare migrate

Patch Changes

  • #1092 4279043 Thanks @vicb! - Check for supported Next version

    The build will now error for unsupported Next version which may contain unpatched security vulnerabilities. You can bypass the check using the --dangerouslyUseUnsupportedNextVersion flag.

1.15.1

Patch Changes

  • #1085 74302ec Thanks @vicb! - fix the detection of the runtime (webpack vs turbopack)

1.15.0

Minor Changes

Patch Changes

  • #1076 c99eefd Thanks @vicb! - fix: do not bundle og when not used

    This saves ~500kB when og is not used

  • #1079 6ac789a Thanks @vicb! - fix: use the correct runtime (i.e. webpack or turbopack)

  • #1078 249f738 Thanks @vicb! - drop unused react-dom modules

    This saves ~500kB on the output bundle

1.14.10

Patch Changes

1.14.9

Patch Changes

1.14.8

Patch Changes

1.14.7

Patch Changes

1.14.6

Patch Changes

1.14.5

Patch Changes

1.14.4

Patch Changes

  • #1020 07919d8 Thanks @dario-piotrowicz! - Add missing WORKER_SELF_REFERENCE service binding in the wrangler.jsonc that the CLI creates

  • #1032 1de4899 Thanks @vicb! - fix(images): allow any local path when no localPatterns are specified

1.14.3

Patch Changes

1.14.2

Patch Changes

1.14.1

Patch Changes

1.14.0

Minor Changes

1.13.1

Patch Changes

1.13.0

Minor Changes

Patch Changes

1.12.0

Minor Changes

1.11.1

Patch Changes

  • #968 ddb0589 Thanks @rgembalik! - fix: Compiled config is now imported using pathToFileURL to avoid crashes on Windows.

  • #958 7edf91c Thanks @vicb! - fix: add missing awaits

  • #978 d7ad53e Thanks @vicb! - error early when a node middleware is detected

  • #976 93f4c8a Thanks @rgembalik! - fix: shell quoting on windows machines to avoid upload errors for routes with [...path] segments

1.11.0

Minor Changes

  • #925 62fee71 Thanks @krzysztof-palka-monogo! - feature: optional batch upload for faster R2 cache population

    This update adds optional batch upload support for R2 cache population, significantly improving upload performance for large caches when enabled via .env or environment variables.

    Key Changes:

    1. Optional Batch Upload: Configure R2 credentials via .env or environment variables to enable faster batch uploads:

      • R2_ACCESS_KEY_ID
      • R2_SECRET_ACCESS_KEY
      • CF_ACCOUNT_ID
    2. Automatic Detection: When credentials are detected, batch upload is automatically used for better performance

    3. Smart Fallback: If credentials are not configured, the CLI falls back to standard Wrangler uploads with a helpful message about enabling batch upload for better performance

    All deployment commands support batch upload:

    • populateCache - Explicit cache population
    • deploy - Deploy with cache population
    • upload - Upload version with cache population
    • preview - Preview with cache population

    Performance Benefits (when batch upload is enabled):

    • Parallel transfer capabilities (32 concurrent transfers)
    • Significantly faster for large caches
    • Reduced API calls to Cloudflare

    Usage:

    Add the credentials in a .env/.dev.vars file in your project root:

    R2_ACCESS_KEY_ID=your_key
    R2_SECRET_ACCESS_KEY=your_secret
    CF_ACCOUNT_ID=your_account

    You can also set the environment variables for CI builds.

    Note:

    You can follow documentation https://developers.cloudflare.com/r2/api/tokens/ for creating API tokens with appropriate permissions for R2 access.

Patch Changes

1.10.1

Patch Changes

1.10.0

Minor Changes

  • #937 32ba91a Thanks @vicb! - feat: retrieve CLI environment variables from process.env and .env* files

    Recommended usage on CI:

    • Add your secrets to process.env (i.e. CF_ACCOUNT_ID)
    • Add public values to the wrangler config wrangler.jsonc (i.e. R2_CACHE_PREFIX_ENV_NAME)

    Recommended usage for local dev:

    • Add your secrets to either a .dev.vars* or .env* file (i.e. CF_ACCOUNT_ID)
    • Add public values to the wrangler config wrangler.jsonc (i.e. R2_CACHE_PREFIX_ENV_NAME)

Patch Changes

1.9.2

Patch Changes

1.9.1

Patch Changes

1.9.0

Minor Changes

Patch Changes

  • #907 ba4cac5 Thanks @vicb! - refactor: only try to purge the cache when invalidation is configured

1.8.5

Patch Changes

  • #901 17a4bea Thanks @vicb! - chore: bump wrangler to ^4.38.0

  • #903 7fced0f Thanks @vicb! - fix: enable using workerd process v2

    process v2 is an updated version of node:process active by default after 2025-09-15

1.8.4

Patch Changes

  • #888 51322a8 Thanks @james-elicx! - fix: remote flag not working for preview command's cache population

    Previously, passing the --remote flag when running opennextjs-cloudflare preview --remote would not result in the remote preview binding being populated, and would throw errors due to a missing preview flag when populating Workers KV. The remote flag is now supported for the cache popoulation step when running the preview command.

    • opennextjs-cloudflare preview --remote will populate the remote binding for the preview ID specified in your Wrangler config.
    • opennextjs-cloudflare preview will continue to populate the local binding in your Wrangler config.

1.8.3

Patch Changes

1.8.2

Patch Changes

1.8.1

Patch Changes

1.8.0

Minor Changes

  • #862 728ad99 Thanks @james-elicx! - feat: support for a custom OpenNext config path with the --openNextConfigPath flag

Patch Changes

1.7.1

Patch Changes

1.7.0

Minor Changes

  • #848 f80c801 Thanks @sommeeeer! - Ensure that the initial request.signal is passed to the wrapper

    request.signal.onabort is now supported in route handlers. It requires that the signal from the original worker's request is passed to the handler. It will then pass along that AbortSignal through the streamCreator in the wrapper. This signal will destroy the response sent to NextServer when a client aborts, thus triggering the signal in the route handler.

    See the changelog in Cloudflare here.

    Note: If you have a custom worker, you must update your code to pass the original request.signal to the handler. You also need to enable the compatibility flag enable_request_signal to use this feature.

    For example:

    // Before:
    return handler(reqOrResp, env, ctx);
    
    // After:
    return handler(reqOrResp, env, ctx, request.signal);
  • #850 ce5c7b4 Thanks @dario-piotrowicz! - Add option for regional cache to skip tagCache on cache hits

    When the tag regional cache finds a value in the incremental cache, checking such value in the tagCache can be skipped, this helps reducing response times at the tradeoff that the user needs to either use the automatic cache purging or manually purge the cache when appropriate. For this the bypassTagCacheOnCacheHit option is being added to the RegionalCache class.

    Example:

    import { defineCloudflareConfig } from "@opennextjs/cloudflare";
    import d1NextTagCache from "@opennextjs/cloudflare/overrides/tag-cache/d1-next-tag-cache";
    import memoryQueue from "@opennextjs/cloudflare/overrides/queue/memory-queue";
    import r2IncrementalCache from "@opennextjs/cloudflare/overrides/incremental-cache/r2-incremental-cache";
    import { withRegionalCache } from "@opennextjs/cloudflare/overrides/incremental-cache/regional-cache";
    
    export default defineCloudflareConfig({
    	incrementalCache: withRegionalCache(r2IncrementalCache, {
    		mode: "long-lived",
    		bypassTagCacheOnCacheHit: true,
    	}),
    	tagCache: d1NextTagCache,
    	queue: memoryQueue,
    });

Patch Changes

1.6.5

Patch Changes

1.6.4

Patch Changes

1.6.3

Patch Changes

1.6.2

Patch Changes

1.6.1

Patch Changes

1.6.0

Minor Changes

Patch Changes

1.5.3

Patch Changes

  • #804 72d8d5b Thanks @alex-all3dp! - Fix missing SQL parameter bindings in D1NextModeTagCache.getLastRevalidated()

1.5.2

Patch Changes

1.5.1

Patch Changes

  • #781 e984e8f Thanks @vicb! - fallback to the upstream image content-type header

  • #779 224a2f0 Thanks @petebacondarwin! - Ensure that the cloudflare library is available at runtime

    Previously it was only a devDependency which meant it was missing in real life installations of the tool.

    The error looked like:

    Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'cloudflare' imported from @opennextjs/cloudflare/dist/cli/commands/skew-protection.js
    

1.5.0

Minor Changes

  • #768 40f7e72 Thanks @vicb! - Add an asset resolver to support run_worker_first=true

  • #746 6d020fe Thanks @vicb! - feat: add support for experimental skew protection

Patch Changes

  • #776 bd448a8 Thanks @vicb! - Add support for images CSP, disposition, and allow SVG

1.4.0

Minor Changes

1.3.1

Patch Changes

  • #730 ae31733 Thanks @vicb! - add tests for remote patterns

  • #738 b911c3e Thanks @sommeeeer! - fix: support Next 14 experimental.serverComponentsExternalPackages

  • #740 d8150d2 Thanks @sommeeeer! - feat(images): implement localPatterns for images

  • #720 9ed8d8a Thanks @james-elicx! - feat: pass cli arguments not used by opennextjs-cloudflare to wrangler

    Previously, arguments had to be provided after -- e.g. opennextjs-cloudflare preview -- --port 12345. This is no longer necessary, and they can be provided normally, e.g. opennextjs-cloudflare preview --port 12345.

  • #743 7a2fc7d Thanks @vicb! - update @opennextjs/aws to 3.6.6

    3.6.6 Release notes

  • #712 2f6dd81 Thanks @vicb! - Drop the patch for NextServer#getMiddlewareManifest (taken care of by was)

1.3.0

Minor Changes

  • #727 36119c0 Thanks @vicb! - Enforce remotePatterns when fetching external images

1.2.1

Patch Changes

1.2.0

Minor Changes

  • #696 de6a6cd Thanks @vicb! - Add the routePreloadingBehavior to the options of defineCloudflareConfig.

    The default is set to "none" as other values might increase CPU usage on cold starts.

Patch Changes

  • #700 56e9366 Thanks @vicb! - perf: drop @ampproject/toolbox-optimizer to reduce the server bundle size

  • #689 64a10a6 Thanks @sommeeeer! - fix: Ensure the protocol is correct for redirects in server actions during preview mode

  • #710 903ad45 Thanks @vicb! - perf: drop babel to reduce the server bundle size

1.1.0

Minor Changes

Patch Changes

1.0.4

Patch Changes

1.0.3

Patch Changes

1.0.2

Patch Changes

  • #656 a20d2df Thanks @conico974! - revert to using an external middleware

    This will reduce cpu time for anything coming from the routing layer (i.e. redirects, rewrites, middleware response or when using cache interception)

1.0.1

Patch Changes

1.0.0

  • #613 2d82fad Thanks @conico974! - Bump aws to 3.6.0

    Introduce support for the composable cache

    BREAKING CHANGE: The interface for the Incremental cache has changed. The new interface use a Cache type instead of a boolean to distinguish between the different types of caches. It also includes a new Cache type for the composable cache. The new interface is as follows:

    export type CacheEntryType = "cache" | "fetch" | "composable";
    
    export type IncrementalCache = {
    	get<CacheType extends CacheEntryType = "cache">(
    		key: string,
    		cacheType?: CacheType
    	): Promise<WithLastModified<CacheValue<CacheType>> | null>;
    	set<CacheType extends CacheEntryType = "cache">(
    		key: string,
    		value: CacheValue<CacheType>,
    		isFetch?: CacheType
    	): Promise<void>;
    	delete(key: string): Promise<void>;
    	name: string;
    };

    NextModeTagCache also get a new function getLastRevalidated used for the composable cache:

      getLastRevalidated(tags: string[]): Promise<number>;
  • #640 af60dea Thanks @vicb! - fix: escape shell arguments when populating the cache

  • #628 a169b76 Thanks @conico974! - fix issues with build conditions and wasm

  • #619 09aaf35 Thanks @conico974! - global timer functions now use the one from node:timers

  • #593 faca3e1 Thanks @vicb! - Use the workerd build condition by default

  • #641 e07a2ed Thanks @conico974! - some performance improvements

    • enableCacheInterception can be enabled using defineCloudflareConfig, it loads ISR/SSG pages from cache without waiting for the js page bundle to load. PPR is not supported at the moment
    • routePreloadingBehavior is now set to withWaitUntil, which means a single route js will be lazy loaded on cold start, but other routes will be preloaded using waitUntil for better performance
  • #639 c4d278e Thanks @conico974! - polyfill import.meta.url

  • #622 f5264d2 Thanks @james-elicx! - feat: use getPlatformProxy for cache population prefix vars

  • #616 f129602 Thanks @james-elicx! - feat: prefix for kv cache keys

  • #644 899bae0 Thanks @conico974! - fix cache population for R2

  • #626 de9e05a Thanks @james-elicx! - feat: bulk insert cache entries to KV

1.0.0-beta.4

Changes

  • #595 b0c14e1 Thanks @vicb! - drop support for wrangler v3

  • #608 055a61b Thanks @conico974! - Add a new withFilter tag cache to allow to filter the tags used

  • #591 0361672 Thanks @vicb! - Add an example of creating a custom worker

    Creating a custom worker enable adding DO, handlers (scheduled, queue, ...)

    closes #207, #397, #589

  • #607 15f1160 Thanks @conico974! - fix page router shared context to use the correct one

1.0.0-beta.3

Changes

1.0.0-beta.2

Changes

1.0.0-beta.1

Changes

1.0.0-beta.0

Minor Changes

  • #526 8b40268 Thanks @vicb! - Prepare for release 1.0.0-beta.0

    Bump @opennextjs/aws to 3.5.4

    BREAKING CHANGES

    • DurableObjectQueueHandler renamed to DOQueueHandler
    • NEXT_CACHE_DO_QUEUE_MAX_NUM_REVALIDATIONS renamed to NEXT_CACHE_DO_QUEUE_MAX_RETRIES
    • D1TagCache has been removed, use D1NextModeTagCache instead.
    • The enableShardReplication and shardReplicationOptions options passed to ShardedDOTagCache have been folded into shardReplication. A value for shardReplication must be specified to enable replications. The value must be an object with the number of soft and hard replicas.

0.6.6

Patch Changes

  • #520 3bd200a Thanks @vicb! - Define process.version and process.versions.node

  • #522 79fadc4 Thanks @vicb! - Log exceptions in requirePage and NodeModuleLoader when OPEN_NEXT_DEBUG=1

  • #523 19dedc7 Thanks @vicb! - fix: process.env has a higher loading priority than .env files

  • #469 aef8e51 Thanks @Juuldamen! - Adds support for passing options to initOpenNextCloudflareForDev(). This allows you to configure how your Cloudflare bindings will behave during local development.

    For example, the below configuration will persist the local state of bindings to a custom directory. Which can be useful if you want to share the state between different apps that reuse the same bindings in a monorepo.

    initOpenNextCloudflareForDev({
    	persist: {
    		path: "../../.wrangler/state/v3/custom-dir",
    	},
    });

    You can find the configuration type with it's available options here in the Wrangler source code.

0.6.5

Patch Changes

0.6.4

Patch Changes

0.6.3

Patch Changes

0.6.2

Patch Changes

0.6.1

Patch Changes

0.6.0

Minor Changes

  • #499 5037f57 Thanks @vicb! - Refactor the codebase for consistency

    BREAKING CHANGE

    Overrides:

    Overrides now live in @opennextjs/cloudflare/overrides and some files have been renamed.

    • Incremental cache overrides: @opennextjs/cloudflare/overrides/incremental-cache/...
    • Tag cache overrides: @opennextjs/cloudflare/overrides/tag-cache/...
    • Queue overrides: @opennextjs/cloudflare/overrides/queue/...

    For example the KV incremental cache override can be imported as @opennextjs/cloudflare/overrides/incremental-cache/kv-incremental-cache.

    Environment variables and bindings name changes:

    • NEXT_CACHE_WORKERS_KV -> NEXT_INC_CACHE_KV
    • NEXT_CACHE_R2_... -> NEXT_INC_CACHE_R2_...
    • NEXT_CACHE_D1 -> NEXT_TAG_CACHE_D1
    • NEXT_CACHE_DO_... -> NEXT_TAG_CACHE_DO_...
    • NEXT_CACHE_DO_REVALIDATION -> NEXT_CACHE_DO_QUEUE
    • NEXT_CACHE_REVALIDATION_WORKER -> WORKER_SELF_REFERENCE

    Other:

    NEXT_CACHE_D1_TAGS_TABLE and NEXT_CACHE_D1_REVALIDATIONS_TABLE have been dropped. The tables have a fixed names tags and revalidations.

  • #479 0c93e8b Thanks @james-elicx! - feat: commands for cli actions

    The OpenNext Cloudflare CLI now uses the following commands;

    • build: build the application
    • populateCache: populate either the local or remote cache
    • preview: populate the local cache and start a dev server
    • deploy: populate the remote cache and deploy to production
  • #490 00f6071 Thanks @vicb! - Drop the deprecated kvCache in favor of kv-cache

Patch Changes

0.5.12

Patch Changes

0.5.11

Patch Changes

0.5.10

Patch Changes

  • #445 6a389fe Thanks @james-elicx! - fix: deployed worker unable to invoke itself in memory queue

    In deployments, Cloudflare Workers are unable to invoke workers on the same account via fetch, and the recommended way to call a worker is to use a service binding. This change switches to use service bindings for the memory queue to avoid issues with worker-to-worker subrequests.

    To continue using the memory queue, add a service binding to your wrangler config for the binding NEXT_CACHE_REVALIDATION_WORKER.

    {
    	"services": [
    		{
    			"binding": "NEXT_CACHE_REVALIDATION_WORKER",
    			"service": "<WORKER_NAME>"
    		}
    	]
    }

0.5.9

Patch Changes

0.5.8

Patch Changes

  • #431 9ad6714 Thanks @HyperKiko! - fix pages api routes

    fixed pages api routes by inlining a dynamic require in the NodeModuleLoader class

0.5.7

Patch Changes

0.5.6

Patch Changes

  • #412 58b200f Thanks @dario-piotrowicz! - add defineCloudflareConfig utility

    this change adds a new defineCloudflareConfig utility that developers can use in their open-next.config.ts file to easily generate a configuration compatible with the adapter

    Example usage:

    // open-next.config.ts
    import { defineCloudflareConfig } from "@opennextjs/cloudflare";
    import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache";
    
    export default defineCloudflareConfig({
    	incrementalCache: kvIncrementalCache,
    });

0.5.5

Patch Changes

0.5.4

Patch Changes

  • #320 ff2dd55 Thanks @james-elicx! - feat: d1 adapter for the tag cache

  • #409 a604c85 Thanks @dario-piotrowicz! - make sure that instrumentation files work

    currently instrumentation files in applications built using the adapter are ignored, the changes here make sure that those are instead properly included in the applications

  • #410 d30424b Thanks @dario-piotrowicz! - remove eval calls introduced by depd wrapped functions

    Some dependencies of Next.js (raw-body and send) use depd to deprecate some of their functions, depd uses eval to generate a deprecated version of such functions, this causes eval warnings in the terminal even if these functions are never called, the changes here by patching the depd wrapfunction function so that it still retains the same type of behavior but without using eval

  • #404 12d385d Thanks @dario-piotrowicz! - fix incorrect (sync) getCloudflareContext error message

    currently getCloudflareContext run in sync mode at the top level of a not static route gives a misleading error message saying that the function needs to be run in a not static route, the changes here correct this error message clarifying that the problem actually is

0.5.3

Patch Changes

0.5.2

Patch Changes

  • #372 522076b Thanks @dario-piotrowicz! - add "async mode" to getCloudflareContext

    Add an async option to getCloudflareContext({async}) to run it in "async mode", the difference being that the returned value is a promise of the Cloudflare context instead of the context itself

    The main of this is that it allows the function to also run during SSG (since the missing context can be created on demand).

0.5.1

Patch Changes

  • ad895ed: fix: vercel og patch not moving to right node_modules directory

    There are two separate places where the node_modules could be. One is a package-scoped node_modules which does not always exist - if it doesn't exist, the server functions-scoped node_modules is used.

0.5.0

Minor Changes

  • 82bb588: feat: basic in-memory de-duping revalidation queue

Patch Changes

  • 2e48d4f: fix: make sure that fetch cache sets are properly awaited

    Next.js does not await promises that update the incremental cache for fetch requests, that is needed in our runtime otherwise the cache updates get lost, so this change makes sure that the promise is properly awaited via waitUntil

  • 0c26049: fix path to file template in open-next.config.ts.

0.4.8

Patch Changes

  • ac8b271: fix waitUntil

    Calling waitUntil/after was failing when mulitple requests were handled concurrently. This is fixed by pulling opennextjs/opennextjs-aws#733

  • 761a312: import randomUUID from node:crypto to support NodeJS 18

0.4.7

Patch Changes

  • 420b598: Fix asset cache path

  • a19b34d: perf: reduce CPU and memory usage by limiting code to AST parsing

  • f30a5fe: bump @opennextjs/aws dependency to https://pkg.pr.new/@opennextjs/aws@727

  • 6791cea: Use kebab-case for the KV Cache.

  • a630aea: fix: enable using the direct queue for isr

    The direct mode is not recommended for use in production as it does not de-dupe requests.

  • f30a5fe: Fix: make sure that the kvCache doesn't serve stale cache values from assets when there is no KV binding

0.4.6

Patch Changes

  • 9561277: fix: remove dynamic require for map file

    ESBuild tries to load all files in the chunks folder with require("./chunks/" + var). This is an error when the folder contains map file.

0.4.5

Patch Changes

  • 1ccff65: bump @opennextjs/aws dependency to https://pkg.pr.new/@opennextjs/aws@724

    this bump fixes rewrites to external urls not working when the external urls point to resources hosted on the Cloudflare network

  • 30374b9: fix: Drop the module condition from ESBuild

    Because Next (via nft) does not use the module condition, ESBuild should not use it. Otherwise we might end up with missing files and a broken build.

0.4.4

Patch Changes

  • 6103547: fix: provide a proper error message when using getCloudflareContext in static routes

    getCloudflareContext can't be used in static routes, currently a misleading error message incorrectly tells the developer that they haven't called initOpenNextCloudflareForDev in their config file, this change updates such error message to properly clarify what the issue is (and how to solve it)

  • 0a6191d: fix the encoding of __NEXT_PRIVATE_STANDALONE_CONFIG

  • da7f8d8: fix: enable PPR with wrangler dev

  • 714172d: fix: trailing slash redirect

  • 0892679: fix: inline optional dependencies when bundling the server

0.4.3

Patch Changes

  • 9d45ee8: fix the error message of getCloudflareContext

    Hardcode function names that would get mangled otherwise.

  • ac52954: bump the wrangler peer dependency (so to avoid multiple Using vars defined in .dev.vars logs during local development)

0.4.2

Patch Changes

  • 1b3a972: Dump ESBuild metadata to handler.mjs.meta.json

    The ESBuild metadata are written to a file alongside handler.mjs in .open-next/server-functions/default/...

  • 5c90521: refactor: Make the list of optional dependencies configurable

  • 67acb2f: fix build issues with @opentelemetry

    By using the pre-compiled library provided by Next.

  • 3ed6cd1: fix: syntax error

0.4.1

Patch Changes

  • 1a2b815: fix: make sure that the initOpenNextCloudflareForDev() logic runs only once

    Currently calling initOpenNextCloudflareForDev() in the Next.js config file causes this initialization logic to run twice, consuming more resources and causing extra noise in the terminal logs, this change makes sure that the initialization logic is run only once instead

0.4.0

Minor Changes

  • 8de2c04: introduce new initOpenNextCloudflareForDev utility and make getCloudflareContext synchronous

    this change introduces a new initOpenNextCloudflareForDev function that must called in the Next.js config file to integrate the Next.js dev server with the open-next Cloudflare adapter.

    Also makes getCloudflareContext synchronous.

    Additionally the getCloudflareContext can now work during local development (next dev) in the edge runtime (including middlewares).

    Moving forward we'll recommend that all applications include the use of the initOpenNextCloudflareForDev utility in their config file (there is no downside in doing so and it only effect local development).

    Example:

    // next.config.mjs
    
    import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
    
    initOpenNextCloudflareForDev();
    
    /** @type {import('next').NextConfig} */
    const nextConfig = {};
    
    export default nextConfig;

Patch Changes

  • 4ec334a: fix: @vercel/og failing due to using the node version.

    Patches usage of the @vercel/og library to require the edge runtime version, and enables importing of the fallback font.

0.3.10

Patch Changes

  • 48f863f: fix: do not require caniuse-lite

    caniuse-lite is an optional dependency.

  • 27ab1ab: refactor: use the new regex utility for constructing cross-platform paths

0.3.9

Patch Changes

  • 67fafeb: fix top level awaits not working in middlewares by bumping the @opennextjs/aws package

0.3.8

Patch Changes

  • 05ee8d4: fix: invalid paths in windows bundles.

0.3.7

Patch Changes

  • 41c55a8: Add support for specifying wrangler environment when using next dev so that bindings and vars are properly loaded. This can be specified with the env variable NEXT_DEV_WRANGLER_ENV.
  • 2e13de2: fix broken patchRequireReactDomServerEdge patch

0.3.6

Patch Changes

  • 9ab86d4: fix: host not included in route handler urls

    Next.js was unable to re-construct the correct URLs for the request in a route handler due to being unable to retrieve the hostname. This was due to the internal Next.js option trustHostHeader being disabled in OpenNext when there is external middleware - this option is needed for the Next.js server in our environment.

0.3.5

Patch Changes

  • 77e31d5: update the patchExceptionBubbling patch
  • dbcc4be: patch require("react-dom/server.edge") calls in pages.runtime.prod.js so that they are try-catched
  • 632a7d7: show error on Next.js versions older than v14

0.3.4

Patch Changes

  • d488d86: fix: exclude .env.local files for test mode

    Aligns with the Next.js behavior of not extracting variables from the .env.local file in test environments.

  • 0ee77b2: fix the city header encoding

    By pulling opennextjs/opennextjs-aws#688

  • 4b6a50b: check and create a wrangler.json file for the user in case a wrangler.(toml|json|jsonc) file is not already present

    also introduce a new --skipWranglerConfigCheck cli flag and a SKIP_WRANGLER_CONFIG_CHECK environment variable that allows users to opt out of the above check (since developers might want to use custom locations for their config files)

  • 7654867: bump "@opennextjs/aws dependency to https://pkg.pr.new/@opennextjs/aws@686

0.3.3

Patch Changes

  • b3949ce: fix: delete init.cache rather than assign undefined

    Assigning undefined to init.cache throws when using NextAuth

  • 12a1f75: update location of output path in success message

0.3.2

Patch Changes

  • c0c1d04: fix: CustomRequest instantiation

    In some cases some request properties would not be initialized (i.e. method, headers, ...) The bug was caused by the processing the init in the CustomRequest class. The bug was tigerred when using clerk.

0.3.1

Patch Changes

  • f60a326: fix: cleanup dependencies

0.3.0

Minor Changes

  • ca2d452: feat: rename the binary from "cloudflare" to "opennextjs-cloudflare"

    BREAKING CHANGE: After this change the old way of running the tool (e.g. pnpm cloudflare) no longer works. Going forward use the new binary name (e.g. pnpm opennextjs-cloudflare).

    See #161

  • Add support for middleware, loading .env* files, ...

0.2.1

Patch Changes

  • 5bceecc: example: Add vercel blog starter

    Update the examples with vercel blog starter and adapt it to run on cf workers

0.2.0

Minor Changes

  • 6acf0fd: feat: cli arg to disable minification

    The cache handler currently forces minification. There is now a CLI arg to disable minification for the build. At the moment, this only applies to the cache handler but may be used for other parts of the build in the future when minification is introduced to them. By default, minification is enabled, but can be disabled by passing --noMinify.

0.1.1

Patch Changes

  • 66ba0ff: enhancement: Expand missing next.config error message

    Found out that next dev can run the a Next.js app without next.config but if we are using the adapter we throw an error if we don't find the config. So expanded the error for users.

0.1.0

Minor Changes

  • 87f4fb5: feat: configure kv binding name with env var

    The Workers KV binding used in the Next.js cache handler can be given a custom name with the __OPENNEXT_KV_BINDING_NAME environment variable at build-time, instead of defaulting to NEXT_CACHE_WORKERS_KV.

Patch Changes

  • 83abcfe: refactor: retrieve cache handler kv instance inside constructor

    The cache handler was retrieving it's KV instance as a static property on the class that was defined at some point during the execution of the Next.js server. This moves the retrieval of the KV instance to happen inside the constructor for the class, so that it is retrieved during instantiation instead.

0.0.3

Patch Changes

  • a99cd1e: ci: actually publish updates packages to npm

0.0.2

Patch Changes

  • ce8a281: ci: first deployment via changesets