mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #1064] Include deploymentId in "use cache" cache key #233
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#233
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @github-actions[bot] on GitHub (May 5, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/1064
Upstream change
Next.js commit 07f76411b07de9417d4a6b816f3137cafe1045fc changes the cache key seed used by
"use cache"(viacacheHandlers) to includedeploymentId, falling back tobuildIdwhendeploymentIdis unset.Relevant change in
packages/next/src/server/use-cache/use-cache-wrapper.ts:The PR description notes this was previously broken in dev, where
buildId = "development"meant the same cache key was used across deployments.deploymentIdis now threaded through the build pipeline, work store, andAppRouteSharedContext.Test fixture:
test/production/app-dir/use-cache-cross-deployment/(asserts that changingNEXT_DEPLOYMENT_IDorBUILD_IDproduces different cache keys, including across the default cache handler).Why this matters for vinext
vinext implements
"use cache"and ships a KV-basedCacheHandlerfor Cloudflare Workers. To match Next.js parity:"use cache"cache keys must incorporate the deployment identifier so that different deployments do not share cached results.CF_VERSION_METADATA(or a build-time environment variable equivalent toNEXT_DEPLOYMENT_ID).buildIdshould be preserved, and the existingbuildId = "development"problem should be considered for vinext dev mode as well.Action items
deploymentIdvalue through vinext's"use cache"work store / cache key derivation, mirroringworkStore.deploymentId || workStore.buildId.NEXT_DEPLOYMENT_ID) and/or the Workers version metadata when running on Cloudflare.test/production/app-dir/use-cache-cross-deployment/.References
github.com/vercel/next.js@07f76411b0