Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate binding names don't conflict #665

Merged
merged 13 commits into from
Mar 24, 2022
19 changes: 19 additions & 0 deletions .changeset/strange-dingos-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
"wrangler": patch
---

fix: validate that bindings have unique names

We don't want to have, for example, a KV namespace named "DATA"
and a Durable Object also named "DATA". Then it would be ambiguous
what exactly would live at `env.DATA` (or in the case of service workers,
the `DATA` global) which could lead to unexpected behavior -- and errors.

Similarly, we don't want to have multiple resources of the same type
bound to the same name. If you've been working with some KV namespace
called "DATA", and you add a second namespace but don't change the binding
to something else (maybe you're copying-and-pasting and just changed out the `id`),
you could be reading entirely the wrong stuff out of your KV store.

So now we check for those sorts of situations and throw an error if
we find that we've encountered one.
Loading