-
#499
5037f57Thanks @vicb! - Refactor the codebase for consistencyBREAKING CHANGE
Overrides:
Overrides now live in
@opennextjs/cloudflare/overridesand 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_KVNEXT_CACHE_R2_...->NEXT_INC_CACHE_R2_...NEXT_CACHE_D1->NEXT_TAG_CACHE_D1NEXT_CACHE_DO_...->NEXT_TAG_CACHE_DO_...NEXT_CACHE_DO_REVALIDATION->NEXT_CACHE_DO_QUEUENEXT_CACHE_REVALIDATION_WORKER->WORKER_SELF_REFERENCE
Other:
NEXT_CACHE_D1_TAGS_TABLEandNEXT_CACHE_D1_REVALIDATIONS_TABLEhave been dropped. The tables have a fixed namestagsandrevalidations. - Incremental cache overrides:
-
#479
0c93e8bThanks @james-elicx! - feat: commands for cli actionsThe OpenNext Cloudflare CLI now uses the following commands;
build: build the applicationpopulateCache: populate either the local or remote cachepreview: populate the local cache and start a dev serverdeploy: populate the remote cache and deploy to production
-
#490
00f6071Thanks @vicb! - Drop the deprecated kvCache in favor of kv-cache
-
#487
0702d2eThanks @james-elicx! - feat: support passing the wrangler environment when populating the cache -
#480
e0ec01dThanks @conico974! - fix deduplication for memory queue and add some log -
#481
9b0db4dThanks @conico974! - fixres.revalidatenot working in page router api route -
#484
6ce5643Thanks @conico974! - Add sharding replication for the Durable Object Tag Cache -
#470
2650043Thanks @conico974! - feat: add a sharded SQLite Durable object implementation for the tag cache -
#485
ced7d46Thanks @conico974! - add an option for disabling sqlite on the durable object queue -
#460
60171f5Thanks @conico974! - feat: durable object de-duping revalidation queue -
#436
86c0139Thanks @james-elicx! - feat: auto-populating d1 cache data -
#464
acfc7f3Thanks @conico974! - Implement next mode for d1 tag cache that will reduce write -
#486
25a8f4cThanks @conico974! - auto create table for D1NextModeTagCache -
#443
54508ffThanks @james-elicx! - feat: r2 adapter for the incremental cache -
#491
e9dc621Thanks @vicb! - Serve/cdn-cgi/image/...images in dev
-
#455
1d40ab1Thanks @vicb! - sync with@opennextjs/[email protected] -
#453
95caa87Thanks @vicb! - fix: Pages router API routes with Next 14 -
#452
161a5f7Thanks @vicb! - fix: patch the webpack runtime when there is a single chunk
-
#445
6a389feThanks @james-elicx! - fix: deployed worker unable to invoke itself in memory queueIn 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>" } ] }
- #441
4966779Thanks @conico974! - Fix forInvariant: renderHTML should not be called in minimal mode
-
#431
9ad6714Thanks @HyperKiko! - fix pages api routesfixed pages api routes by inlining a dynamic require in the
NodeModuleLoaderclass
-
#412
58b200fThanks @dario-piotrowicz! - adddefineCloudflareConfigutilitythis change adds a new
defineCloudflareConfigutility that developers can use in theiropen-next.config.tsfile to easily generate a configuration compatible with the adapterExample usage:
// open-next.config.ts import { defineCloudflareConfig } from "@opennextjs/cloudflare"; import kvIncrementalCache from "@opennextjs/cloudflare/kv-cache"; export default defineCloudflareConfig({ incrementalCache: kvIncrementalCache, });
-
#413
01e2bfbThanks @ha1fstack! - improve windows support
-
#320
ff2dd55Thanks @james-elicx! - feat: d1 adapter for the tag cache -
#409
a604c85Thanks @dario-piotrowicz! - make sure that instrumentation files workcurrently 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
d30424bThanks @dario-piotrowicz! - removeevalcalls introduced bydepdwrapped functionsSome dependencies of Next.js (
raw-bodyandsend) usedepdto deprecate some of their functions,depdusesevalto generate a deprecated version of such functions, this causesevalwarnings in the terminal even if these functions are never called, the changes here by patching the depdwrapfunctionfunction so that it still retains the same type of behavior but without usingeval -
#404
12d385dThanks @dario-piotrowicz! - fix incorrect (sync)getCloudflareContexterror messagecurrently
getCloudflareContextrun 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
-
#372
522076bThanks @dario-piotrowicz! - add "async mode" togetCloudflareContextAdd an
asyncoption togetCloudflareContext({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 itselfThe main of this is that it allows the function to also run during SSG (since the missing context can be created on demand).
-
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.
- 82bb588: feat: basic in-memory de-duping revalidation queue
-
2e48d4f: fix: make sure that fetch cache
sets are properly awaitedNext.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.
-
ac8b271: fix waitUntil
Calling
waitUntil/afterwas failing when mulitple requests were handled concurrently. This is fixed by pulling opennextjs/opennextjs-aws#733 -
761a312: import
randomUUIDfromnode:cryptoto support NodeJS 18
-
420b598: Fix asset cache path
-
a19b34d: perf: reduce CPU and memory usage by limiting code to AST parsing
-
f30a5fe: bump
@opennextjs/awsdependency tohttps://pkg.pr.new/@opennextjs/aws@727 -
6791cea: Use kebab-case for the KV Cache.
-
a630aea: fix: enable using the
directqueue for isrThe
directmode 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
-
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.
-
1ccff65: bump
@opennextjs/awsdependency tohttps://pkg.pr.new/@opennextjs/aws@724this 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.
-
6103547: fix: provide a proper error message when using
getCloudflareContextin static routesgetCloudflareContextcan't be used in static routes, currently a misleading error message incorrectly tells the developer that they haven't calledinitOpenNextCloudflareForDevin 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
-
9d45ee8: fix the error message of getCloudflareContext
Hardcode function names that would get mangled otherwise.
-
ac52954: bump the
wranglerpeer dependency (so to avoid multipleUsing vars defined in .dev.varslogs during local development)
-
1b3a972: Dump ESBuild metadata to
handler.mjs.meta.jsonThe ESBuild metadata are written to a file alongside
handler.mjsin.open-next/server-functions/default/... -
5c90521: refactor: Make the list of optional dependencies configurable
-
67acb2f: fix build issues with
@opentelemetryBy using the pre-compiled library provided by Next.
-
3ed6cd1: fix: syntax error
-
1a2b815: fix: make sure that the
initOpenNextCloudflareForDev()logic runs only onceCurrently 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
-
8de2c04: introduce new
initOpenNextCloudflareForDevutility and makegetCloudflareContextsynchronousthis change introduces a new
initOpenNextCloudflareForDevfunction that must called in the Next.js config file to integrate the Next.js dev server with the open-next Cloudflare adapter.Also makes
getCloudflareContextsynchronous.Additionally the
getCloudflareContextcan 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
initOpenNextCloudflareForDevutility 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;
-
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.
-
48f863f: fix: do not require
caniuse-litecaniuse-liteis an optional dependency. -
27ab1ab: refactor: use the new regex utility for constructing cross-platform paths
- 67fafeb: fix top level awaits not working in middlewares by bumping the
@opennextjs/awspackage
- 05ee8d4: fix: invalid paths in windows bundles.
- 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
patchRequireReactDomServerEdgepatch
-
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
trustHostHeaderbeing disabled in OpenNext when there is external middleware - this option is needed for the Next.js server in our environment.
- 77e31d5: update the
patchExceptionBubblingpatch - dbcc4be: patch
require("react-dom/server.edge")calls inpages.runtime.prod.jsso that they aretry-catched - 632a7d7: show error on Next.js versions older than v14
-
d488d86: fix: exclude
.env.localfiles fortestmodeAligns with the Next.js behavior of not extracting variables from the
.env.localfile in test environments. -
0ee77b2: fix the city header encoding
By pulling opennextjs/opennextjs-aws#688
-
4b6a50b: check and create a
wrangler.jsonfile for the user in case awrangler.(toml|json|jsonc)file is not already presentalso introduce a new
--skipWranglerConfigCheckcli flag and aSKIP_WRANGLER_CONFIG_CHECKenvironment 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/awsdependency tohttps://pkg.pr.new/@opennextjs/aws@686
-
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
-
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.
- f60a326: fix: cleanup dependencies
-
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, ...
-
5bceecc: example: Add vercel blog starter
Update the examples with vercel blog starter and adapt it to run on cf workers
-
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.
-
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.
-
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_NAMEenvironment variable at build-time, instead of defaulting toNEXT_CACHE_WORKERS_KV.
-
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.
- a99cd1e: ci: actually publish updates packages to npm
- ce8a281: ci: first deployment via changesets