Skip to content

Commit 9bf51d6

Browse files
authored
Validate duplicate bindings across all binding types (#5737)
1 parent 7874ed2 commit 9bf51d6

File tree

5 files changed

+135
-111
lines changed

5 files changed

+135
-111
lines changed

.changeset/fair-fishes-do.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Validate duplicate bindings across all binding types

packages/wrangler/src/__tests__/deploy.test.ts

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6831,7 +6831,7 @@ addEventListener('fetch', event => {});`
68316831
- Text Blobs:
68326832
- TEXT_BLOB_ONE: my-entire-app-depends-on-this.cfg
68336833
- TEXT_BLOB_TWO: the-entirety-of-human-knowledge.txt
6834-
- Unsafe:
6834+
- Unsafe Metadata:
68356835
- some unsafe thing: UNSAFE_BINDING_ONE
68366836
- another unsafe thing: UNSAFE_BINDING_TWO
68376837
- Vars:
@@ -6939,27 +6939,28 @@ addEventListener('fetch', event => {});`
69396939
await expect(runWrangler("deploy index.js")).rejects
69406940
.toMatchInlineSnapshot(`
69416941
[Error: Processing wrangler.toml configuration:
6942-
- CONFLICTING_NAME_ONE assigned to Durable Object, KV Namespace, and R2 Bucket bindings.
6943-
- CONFLICTING_NAME_TWO assigned to Durable Object and KV Namespace bindings.
6944-
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Text Blob, Unsafe, Environment Variable, WASM Module, and Data Blob bindings.
6945-
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Dataset, Text Blob, and Unsafe bindings.
6942+
- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Text Blobs, Unsafe Metadata, Vars, and Wasm Modules bindings.
6943+
- CONFLICTING_NAME_ONE assigned to Durable Objects, KV Namespaces, and R2 Buckets bindings.
6944+
- CONFLICTING_NAME_TWO assigned to Durable Objects and KV Namespaces bindings.
6945+
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Datasets, Text Blobs, and Unsafe Metadata bindings.
69466946
- Bindings must have unique names, so that they can all be referenced in the worker.
69476947
Please change your bindings to have unique names.]
69486948
`);
69496949
expect(std.out).toMatchInlineSnapshot(`""`);
69506950
expect(std.err).toMatchInlineSnapshot(`
6951-
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mProcessing wrangler.toml configuration:[0m
6951+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mProcessing wrangler.toml configuration:[0m
69526952
6953-
- CONFLICTING_NAME_ONE assigned to Durable Object, KV Namespace, and R2 Bucket bindings.
6954-
- CONFLICTING_NAME_TWO assigned to Durable Object and KV Namespace bindings.
6955-
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Text Blob, Unsafe, Environment Variable, WASM
6956-
Module, and Data Blob bindings.
6957-
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Dataset, Text Blob, and Unsafe bindings.
6958-
- Bindings must have unique names, so that they can all be referenced in the worker.
6959-
Please change your bindings to have unique names.
6953+
- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Text Blobs, Unsafe Metadata, Vars,
6954+
and Wasm Modules bindings.
6955+
- CONFLICTING_NAME_ONE assigned to Durable Objects, KV Namespaces, and R2 Buckets bindings.
6956+
- CONFLICTING_NAME_TWO assigned to Durable Objects and KV Namespaces bindings.
6957+
- CONFLICTING_NAME_FOUR assigned to Analytics Engine Datasets, Text Blobs, and Unsafe Metadata
6958+
bindings.
6959+
- Bindings must have unique names, so that they can all be referenced in the worker.
6960+
Please change your bindings to have unique names.
69606961
6961-
"
6962-
`);
6962+
"
6963+
`);
69636964
expect(std.warn).toMatchInlineSnapshot(`
69646965
"▲ [WARNING] Processing wrangler.toml configuration:
69656966
@@ -7046,28 +7047,28 @@ addEventListener('fetch', event => {});`
70467047
await expect(runWrangler("deploy index.js")).rejects
70477048
.toMatchInlineSnapshot(`
70487049
[Error: Processing wrangler.toml configuration:
7049-
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
7050-
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
7051-
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
7052-
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
7053-
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
7050+
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
7051+
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
7052+
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
7053+
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
7054+
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
70547055
- Bindings must have unique names, so that they can all be referenced in the worker.
70557056
Please change your bindings to have unique names.]
70567057
`);
70577058
expect(std.out).toMatchInlineSnapshot(`""`);
70587059
expect(std.err).toMatchInlineSnapshot(`
7059-
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mProcessing wrangler.toml configuration:[0m
7060+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mProcessing wrangler.toml configuration:[0m
70607061
7061-
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
7062-
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
7063-
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
7064-
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
7065-
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
7066-
- Bindings must have unique names, so that they can all be referenced in the worker.
7067-
Please change your bindings to have unique names.
7062+
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
7063+
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
7064+
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
7065+
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
7066+
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
7067+
- Bindings must have unique names, so that they can all be referenced in the worker.
7068+
Please change your bindings to have unique names.
70687069
7069-
"
7070-
`);
7070+
"
7071+
`);
70717072
expect(std.warn).toMatchInlineSnapshot(`
70727073
"▲ [WARNING] Processing wrangler.toml configuration:
70737074
@@ -7196,34 +7197,34 @@ addEventListener('fetch', event => {});`
71967197
await expect(runWrangler("deploy index.js")).rejects
71977198
.toMatchInlineSnapshot(`
71987199
[Error: Processing wrangler.toml configuration:
7199-
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
7200-
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
7201-
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
7202-
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, Unsafe, Environment Variable, WASM Module, and Data Blob bindings.
7203-
- CONFLICTING_NAME_FOUR assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, and Unsafe bindings.
7204-
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
7205-
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
7200+
- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Analytics Engine Datasets, Text Blobs, Unsafe Metadata, Vars, and Wasm Modules bindings.
7201+
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
7202+
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
7203+
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
7204+
- CONFLICTING_NAME_FOUR assigned to R2 Buckets, Analytics Engine Datasets, Text Blobs, and Unsafe Metadata bindings.
7205+
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
7206+
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
72067207
- Bindings must have unique names, so that they can all be referenced in the worker.
72077208
Please change your bindings to have unique names.]
72087209
`);
72097210
expect(std.out).toMatchInlineSnapshot(`""`);
72107211
expect(std.err).toMatchInlineSnapshot(`
7211-
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mProcessing wrangler.toml configuration:[0m
7212-
7213-
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Object bindings.
7214-
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespace bindings.
7215-
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Bucket bindings.
7216-
- CONFLICTING_NAME_THREE assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, Unsafe,
7217-
Environment Variable, WASM Module, and Data Blob bindings.
7218-
- CONFLICTING_NAME_FOUR assigned to R2 Bucket, Analytics Engine Dataset, Text Blob, and Unsafe
7219-
bindings.
7220-
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Dataset bindings.
7221-
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe bindings.
7222-
- Bindings must have unique names, so that they can all be referenced in the worker.
7223-
Please change your bindings to have unique names.
7212+
"[31mX [41;31m[[41;97mERROR[41;31m][0m [1mProcessing wrangler.toml configuration:[0m
7213+
7214+
- CONFLICTING_NAME_THREE assigned to Data Blobs, R2 Buckets, Analytics Engine Datasets, Text
7215+
Blobs, Unsafe Metadata, Vars, and Wasm Modules bindings.
7216+
- CONFLICTING_DURABLE_OBJECT_NAME assigned to multiple Durable Objects bindings.
7217+
- CONFLICTING_KV_NAMESPACE_NAME assigned to multiple KV Namespaces bindings.
7218+
- CONFLICTING_R2_BUCKET_NAME assigned to multiple R2 Buckets bindings.
7219+
- CONFLICTING_NAME_FOUR assigned to R2 Buckets, Analytics Engine Datasets, Text Blobs, and
7220+
Unsafe Metadata bindings.
7221+
- CONFLICTING_AE_DATASET_NAME assigned to multiple Analytics Engine Datasets bindings.
7222+
- CONFLICTING_UNSAFE_NAME assigned to multiple Unsafe Metadata bindings.
7223+
- Bindings must have unique names, so that they can all be referenced in the worker.
7224+
Please change your bindings to have unique names.
72247225
7225-
"
7226-
`);
7226+
"
7227+
`);
72277228
expect(std.warn).toMatchInlineSnapshot(`
72287229
"▲ [WARNING] Processing wrangler.toml configuration:
72297230
@@ -8395,7 +8396,7 @@ addEventListener('fetch', event => {});`
83958396
"Total Upload: xx KiB / gzip: xx KiB
83968397
Worker Startup Time: 100 ms
83978398
Your worker has access to the following bindings:
8398-
- Unsafe:
8399+
- Unsafe Metadata:
83998400
- binding-type: my-binding
84008401
Uploaded test-name (TIMINGS)
84018402
Deployed test-name triggers (TIMINGS)
@@ -8442,7 +8443,7 @@ addEventListener('fetch', event => {});`
84428443
"Total Upload: xx KiB / gzip: xx KiB
84438444
Worker Startup Time: 100 ms
84448445
Your worker has access to the following bindings:
8445-
- Unsafe:
8446+
- Unsafe Metadata:
84468447
- plain_text: my-binding
84478448
Uploaded test-name (TIMINGS)
84488449
Deployed test-name triggers (TIMINGS)

0 commit comments

Comments
 (0)