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 duplicate bindings across all binding types #5737

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fair-fishes-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

Validate duplicate bindings across all binding types
109 changes: 55 additions & 54 deletions packages/wrangler/src/__tests__/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6831,7 +6831,7 @@ addEventListener('fetch', event => {});`
- Text Blobs:
- TEXT_BLOB_ONE: my-entire-app-depends-on-this.cfg
- TEXT_BLOB_TWO: the-entirety-of-human-knowledge.txt
- Unsafe:
- Unsafe Metadata:
- some unsafe thing: UNSAFE_BINDING_ONE
- another unsafe thing: UNSAFE_BINDING_TWO
- Vars:
Expand Down Expand Up @@ -6939,27 +6939,28 @@ addEventListener('fetch', event => {});`
await expect(runWrangler("deploy index.js")).rejects
.toMatchInlineSnapshot(`
[Error: Processing wrangler.toml configuration:
- CONFLICTING_NAME_ONE assigned to Durable Object, KV Namespace, and R2 Bucket bindings.
- CONFLICTING_NAME_TWO assigned to Durable Object and KV Namespace bindings.
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Text Blob, Unsafe, Environment Variable, WASM Module, and Data Blob bindings.
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Dataset, Text Blob, and Unsafe bindings.
- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Text Blobs, Unsafe Metadata, Vars, and Wasm Modules bindings.
- CONFLICTING_NAME_ONE assigned to Durable Objects, KV Namespaces, and R2 Buckets bindings.
- CONFLICTING_NAME_TWO assigned to Durable Objects and KV Namespaces bindings.
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Datasets, Text Blobs, and Unsafe Metadata bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.]
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Processing wrangler.toml configuration:
"X [ERROR] Processing wrangler.toml configuration:

- CONFLICTING_NAME_ONE assigned to Durable Object, KV Namespace, and R2 Bucket bindings.
- CONFLICTING_NAME_TWO assigned to Durable Object and KV Namespace bindings.
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Text Blob, Unsafe, Environment Variable, WASM
Module, and Data Blob bindings.
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Dataset, Text Blob, and Unsafe bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.
- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Text Blobs, Unsafe Metadata, Vars,
and Wasm Modules bindings.
- CONFLICTING_NAME_ONE assigned to Durable Objects, KV Namespaces, and R2 Buckets bindings.
- CONFLICTING_NAME_TWO assigned to Durable Objects and KV Namespaces bindings.
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Datasets, Text Blobs, and Unsafe Metadata
bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.

"
`);
"
`);
expect(std.warn).toMatchInlineSnapshot(`
"▲ [WARNING] Processing wrangler.toml configuration:

Expand Down Expand Up @@ -7046,28 +7047,28 @@ addEventListener('fetch', event => {});`
await expect(runWrangler("deploy index.js")).rejects
.toMatchInlineSnapshot(`
[Error: Processing wrangler.toml configuration:
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.]
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Processing wrangler.toml configuration:
"X [ERROR] Processing wrangler.toml configuration:

- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.

"
`);
"
`);
expect(std.warn).toMatchInlineSnapshot(`
"▲ [WARNING] Processing wrangler.toml configuration:

Expand Down Expand Up @@ -7196,34 +7197,34 @@ addEventListener('fetch', event => {});`
await expect(runWrangler("deploy index.js")).rejects
.toMatchInlineSnapshot(`
[Error: Processing wrangler.toml configuration:
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, Unsafe, Environment Variable, WASM Module, and Data Blob bindings.
- CONFLICTING_NAME_FOUR assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, and Unsafe bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Analytics Engine Datasets, Text Blobs, Unsafe Metadata, Vars, and Wasm Modules bindings.
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
- CONFLICTING_NAME_FOUR assigned to R2 Buckets, Analytics Engine Datasets, Text Blobs, and Unsafe Metadata bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.]
`);
expect(std.out).toMatchInlineSnapshot(`""`);
expect(std.err).toMatchInlineSnapshot(`
"X [ERROR] Processing wrangler.toml configuration:

- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, Unsafe,
Environment Variable, WASM Module, and Data Blob bindings.
- CONFLICTING_NAME_FOUR assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, and Unsafe
bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.
"X [ERROR] Processing wrangler.toml configuration:

- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Analytics Engine Datasets, Text
Blobs, Unsafe Metadata, Vars, and Wasm Modules bindings.
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
- CONFLICTING_NAME_FOUR assigned to R2 Buckets, Analytics Engine Datasets, Text Blobs, and
Unsafe Metadata bindings.
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
- Bindings must have unique names, so that they can all be referenced in the worker.
Please change your bindings to have unique names.

"
`);
"
`);
expect(std.warn).toMatchInlineSnapshot(`
"▲ [WARNING] Processing wrangler.toml configuration:

Expand Down Expand Up @@ -8395,7 +8396,7 @@ addEventListener('fetch', event => {});`
"Total Upload: xx KiB / gzip: xx KiB
Worker Startup Time: 100 ms
Your worker has access to the following bindings:
- Unsafe:
- Unsafe Metadata:
- binding-type: my-binding
Uploaded test-name (TIMINGS)
Deployed test-name triggers (TIMINGS)
Expand Down Expand Up @@ -8442,7 +8443,7 @@ addEventListener('fetch', event => {});`
"Total Upload: xx KiB / gzip: xx KiB
Worker Startup Time: 100 ms
Your worker has access to the following bindings:
- Unsafe:
- Unsafe Metadata:
- plain_text: my-binding
Uploaded test-name (TIMINGS)
Deployed test-name triggers (TIMINGS)
Expand Down
Loading
Loading