fix(cloudflare): avoid duplicating user KV namespaces when injecting SESSION#16652
Merged
matthewp merged 1 commit intoMay 7, 2026
Conversation
🦋 Changeset detectedLatest commit: ba3e0ac The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
matthewp
approved these changes
May 7, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #16590
Changes
RATE_LIMIT,CACHE) appear twice in the generateddist/server/wrangler.json, causing wrangler to fail with"<binding> assigned to multiple KV Namespace bindings.".SESSIONbinding fromkv_namespaces, instead of pre-merging the user's existing bindings into the output.@cloudflare/vite-pluginalready merges the customizer's output with the user's wrangler config, so echoing the user's bindings caused the duplication.withSessionKVBinding()helper.@astrojs/cloudflarepatch).Affected versions reported in the issue:
@astrojs/cloudflare@13.3.0–13.3.1+astro@6.2.x. Last working combination wasastro@6.1.9+@astrojs/cloudflare@13.2.1, which matches the pre-#16555 behavior this PR restores.Testing
packages/integrations/cloudflare/test/wrangler.test.tsthat locked in the buggy merged-output shape.does not include user-declared KV bindings in the output (regression #16590)covering the multi-binding scenario from the issue (RATE_LIMIT+CACHEdeclared by the user) and asserting the customizer returns only[{ binding: 'SESSION' }].wrangler.test.tspass locally.Docs
No documentation changes needed. The fix restores documented and previously-shipped behavior — the public API and configuration surface (
sessionKVBindingName, automaticSESSIONbinding provisioning) are unchanged.