Migrate from 0.5 to 0.6
@opennextjs/cloudflare@0.6.0
introduces more options for caching.
The codebase has been refactored with some breaking changes, read-on to update your apps:
Overrides location
The cloudflare overrides now live in @opennextjs/cloudflare/overrides
:
- 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 now imported as @opennextjs/cloudflare/overrides/incremental-cache/kv-incremental-cache
.
Environment variables and bindings
We have updated the name for consistency:
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
NEXT_CACHE_D1_TAGS_TABLE
and NEXT_CACHE_D1_REVALIDATIONS_TABLE
have been dropped.
The D1 tables have a fixed names tags
and revalidations
.
CLI
The CLI was previsouly invoked as opennextjs-cloudflare
and now takes a mandatory command:
opennextjs-cloudflare build
is the equivalent of executingopennextjs-cloudflare
previouslyopennextjs-cloudflare populateCache local
is used to populate thelocal
orremote
cacheopennextjs-cloudflare preview
is used to populate the local cache and start a dev serveropennextjs-cloudflare deploy
is used to populate the remote cache and deploy
You will need to update the scripts
in your package.json
:
"preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview",
"deploy": "opennextjs-cloudflare build && opennextjs-cloudflare deploy",