From 3bd833cbe29b92edf512759833f0a0115e1799bc Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Thu, 29 Aug 2024 16:20:21 +0100 Subject: [PATCH] GA versions/deployments commands (#6497) * Default x-versions to true and allow negating with no-x-versions * Update `wrangler deploy` to use the new versions/deployments API --- .changeset/mighty-seas-change.md | 9 + .changeset/thirty-boats-knock.md | 7 + packages/wrangler/e2e/deployments.test.ts | 119 +- packages/wrangler/e2e/versions.test.ts | 120 +- .../wrangler/src/__tests__/deploy.test.ts | 4109 +++++++---------- .../src/__tests__/deployments.test.ts | 378 +- .../__tests__/deprecated-usage-model.test.ts | 30 +- .../__tests__/helpers/mock-upload-worker.ts | 53 +- .../helpers/msw/handlers/versions.ts | 7 +- packages/wrangler/src/__tests__/index.test.ts | 112 +- .../deployments/deployments.list.test.ts | 564 +-- .../__tests__/versions/versions.help.test.ts | 77 +- .../__tests__/versions/versions.list.test.ts | 360 +- packages/wrangler/src/deploy/deploy.ts | 147 +- packages/wrangler/src/deploy/index.ts | 5 +- packages/wrangler/src/deployments.ts | 14 +- packages/wrangler/src/index.ts | 58 +- packages/wrangler/src/parse.ts | 22 + .../utils/deployment-id-version-id-change.ts | 10 - .../wrangler/src/versions/deployments/list.ts | 4 +- packages/wrangler/src/versions/list.ts | 8 +- .../wrangler/src/versions/rollback/index.ts | 20 +- packages/wrangler/src/versions/types.ts | 1 + 23 files changed, 2884 insertions(+), 3350 deletions(-) create mode 100644 .changeset/mighty-seas-change.md create mode 100644 .changeset/thirty-boats-knock.md delete mode 100644 packages/wrangler/src/utils/deployment-id-version-id-change.ts diff --git a/.changeset/mighty-seas-change.md b/.changeset/mighty-seas-change.md new file mode 100644 index 000000000000..c3f4bd153344 --- /dev/null +++ b/.changeset/mighty-seas-change.md @@ -0,0 +1,9 @@ +--- +"wrangler": minor +--- + +chore: move `wrangler versions ...`, `wrangler deployments ...`, `wrangler rollback` and `wrangler triggers ...` out of experimental and open beta. +These are now available to use without the --x-versions flag, you can continue to pass this however without issue to keep compatibility with all the usage today. + +A few of the commands had an output that wasn't guarded by `--x-versions` those have been updated to use the newer output, we have tried to keep compatibility where possible (for example: `wrangler rollback` will continue to output "Worker Version ID:" so users can continue to grab the ID). +If you wish to use the old versions of the commands you can pass the `--no-x-versions` flag. Note, these will be removed in the future so please work on migrating. diff --git a/.changeset/thirty-boats-knock.md b/.changeset/thirty-boats-knock.md new file mode 100644 index 000000000000..5de88d5807e5 --- /dev/null +++ b/.changeset/thirty-boats-knock.md @@ -0,0 +1,7 @@ +--- +"wrangler": minor +--- + +feat: update `wrangler deploy` to use the new versions and deployments API. +This should have zero user-facing impact but sets up the most used command to deploy Workers to use the new recommended APIs and move away from the old ones. +We will still call the old upload path where required (e.g. Durable Object migration or Service Worker format). diff --git a/packages/wrangler/e2e/deployments.test.ts b/packages/wrangler/e2e/deployments.test.ts index 8b01c9df64a7..db4dd940b9f5 100644 --- a/packages/wrangler/e2e/deployments.test.ts +++ b/packages/wrangler/e2e/deployments.test.ts @@ -62,8 +62,16 @@ describe("deployments", { timeout: TIMEOUT }, () => { it("list 1 deployment", async () => { const output = await helper.run(`wrangler deployments list`); - expect(output.stdout).toContain("Upload from Wrangler 🤠"); - expect(output.stdout).toContain("🟩 Active"); + expect(normalize(output.stdout)).toMatchInlineSnapshot(` + "Created: TIMESTAMP + Author: person@example.com + Source: Upload + Message: Automatic deployment on upload. + Version(s): (100%) 00000000-0000-0000-0000-000000000000 + Created: TIMESTAMP + Tag: - + Message: -" + `); }); it("modify & deploy worker", async () => { @@ -96,19 +104,22 @@ describe("deployments", { timeout: TIMEOUT }, () => { it("list 2 deployments", async () => { const dep = await helper.run(`wrangler deployments list`); expect(normalize(dep.stdout)).toMatchInlineSnapshot(` - "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - Deployment ID: 00000000-0000-0000-0000-000000000000 - Version ID: 00000000-0000-0000-0000-000000000000 - Created on: TIMESTAMP - Author: person@example.com - Source: Upload from Wrangler 🤠 - Deployment ID: 00000000-0000-0000-0000-000000000000 - Version ID: 00000000-0000-0000-0000-000000000000 - Created on: TIMESTAMP - Author: person@example.com - Source: Upload from Wrangler 🤠 - 🟩 Active - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + "Created: TIMESTAMP + Author: person@example.com + Source: Upload + Message: Automatic deployment on upload. + Version(s): (100%) 00000000-0000-0000-0000-000000000000 + Created: TIMESTAMP + Tag: - + Message: - + Created: TIMESTAMP + Author: person@example.com + Source: Unknown (deployment) + Message: - + Version(s): (100%) 00000000-0000-0000-0000-000000000000 + Created: TIMESTAMP + Tag: - + Message: -" `); }); @@ -116,32 +127,68 @@ describe("deployments", { timeout: TIMEOUT }, () => { const output = await helper.run( `wrangler rollback --message "A test message"` ); - expect(output.stdout).toContain("Successfully rolled back"); + expect(normalize(output.stdout)).toMatchInlineSnapshot(` + "├ Fetching latest deployment + │ + ├ Your current deployment has 1 version(s): + │ + │ (100%) 00000000-0000-0000-0000-000000000000 + │ Created: TIMESTAMP + │ Tag: - + │ Message: - + │ + ├ Finding latest stable Worker Version to rollback to + │ + │ + ? Please provide an optional message for this rollback (120 characters max) + 🤖 Using default value in non-interactive context: A test message + │ + ├ WARNING You are about to rollback to Worker Version 00000000-0000-0000-0000-000000000000. + │ This will immediately replace the current deployment and become the active deployment across all your deployed triggers. + │ However, your local development environment will not be affected by this rollback. + │ Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc). + │ + │ (100%) 00000000-0000-0000-0000-000000000000 + │ Created: TIMESTAMP + │ Tag: - + │ Message: - + │ + ? Are you sure you want to deploy this Worker Version to 100% of traffic? + 🤖 Using fallback value in non-interactive context: yes + Performing rollback... + │ + ╰ SUCCESS Worker Version 00000000-0000-0000-0000-000000000000 has been deployed to 100% of traffic. + Current Version ID: 00000000-0000-0000-0000-000000000000" + `); }); it("list deployments", async () => { const dep = await helper.run(`wrangler deployments list`); expect(normalize(dep.stdout)).toMatchInlineSnapshot(` - "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - Deployment ID: 00000000-0000-0000-0000-000000000000 - Version ID: 00000000-0000-0000-0000-000000000000 - Created on: TIMESTAMP - Author: person@example.com - Source: Upload from Wrangler 🤠 - Deployment ID: 00000000-0000-0000-0000-000000000000 - Version ID: 00000000-0000-0000-0000-000000000000 - Created on: TIMESTAMP - Author: person@example.com - Source: Upload from Wrangler 🤠 - Deployment ID: 00000000-0000-0000-0000-000000000000 - Version ID: 00000000-0000-0000-0000-000000000000 - Created on: TIMESTAMP - Author: person@example.com - Source: Rollback from Wrangler 🤠 - Rollback from: 00000000-0000-0000-0000-000000000000 - Message: A test message - 🟩 Active - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + "Created: TIMESTAMP + Author: person@example.com + Source: Upload + Message: Automatic deployment on upload. + Version(s): (100%) 00000000-0000-0000-0000-000000000000 + Created: TIMESTAMP + Tag: - + Message: - + Created: TIMESTAMP + Author: person@example.com + Source: Unknown (deployment) + Message: - + Version(s): (100%) 00000000-0000-0000-0000-000000000000 + Created: TIMESTAMP + Tag: - + Message: - + Created: TIMESTAMP + Author: person@example.com + Source: Unknown (deployment) + Message: A test message + Version(s): (100%) 00000000-0000-0000-0000-000000000000 + Created: TIMESTAMP + Tag: - + Message: -" `); }); diff --git a/packages/wrangler/e2e/versions.test.ts b/packages/wrangler/e2e/versions.test.ts index 78b866396aa7..1023051169e4 100644 --- a/packages/wrangler/e2e/versions.test.ts +++ b/packages/wrangler/e2e/versions.test.ts @@ -76,15 +76,15 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { "Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Unknown (version_upload) - Tag: e2e-upload - Message: Upload via e2e test + Source: Upload + Tag: - + Message: - Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Upload - Tag: - - Message: -" + Source: Unknown (version_upload) + Tag: e2e-upload + Message: Upload via e2e test" `); expect(list.stdout).toMatch(/Message:\s+Upload via e2e test/); @@ -138,20 +138,20 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { expect(normalize(list.stdout)).toMatchInlineSnapshot(` "Created: TIMESTAMP Author: person@example.com - Source: Unknown (deployment) - Message: Deploy via e2e test + Source: Upload + Message: Automatic deployment on upload. Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP - Tag: e2e-upload - Message: Upload via e2e test + Tag: - + Message: - Created: TIMESTAMP Author: person@example.com - Source: Upload - Message: Automatic deployment on upload. + Source: Unknown (deployment) + Message: Deploy via e2e test Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP - Tag: - - Message: -" + Tag: e2e-upload + Message: Upload via e2e test" `); expect(list.stdout).toContain(versionId1); @@ -191,9 +191,9 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { "Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Unknown (version_upload) - Tag: e2e-upload-AGAIN - Message: Upload AGAIN via e2e test + Source: Upload + Tag: - + Message: - Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com @@ -203,9 +203,9 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Upload - Tag: - - Message: -" + Source: Unknown (version_upload) + Tag: e2e-upload-AGAIN + Message: Upload AGAIN via e2e test" `); expect(versionsList.stdout).toMatch(/Message:\s+Upload AGAIN via e2e test/); @@ -260,12 +260,12 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { expect(normalize(deploymentsList.stdout)).toMatchInlineSnapshot(` "Created: TIMESTAMP Author: person@example.com - Source: Unknown (deployment) - Message: Deploy AGAIN via e2e test + Source: Upload + Message: Automatic deployment on upload. Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP - Tag: e2e-upload-AGAIN - Message: Upload AGAIN via e2e test + Tag: - + Message: - Created: TIMESTAMP Author: person@example.com Source: Unknown (deployment) @@ -276,12 +276,12 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Message: Upload via e2e test Created: TIMESTAMP Author: person@example.com - Source: Upload - Message: Automatic deployment on upload. + Source: Unknown (deployment) + Message: Deploy AGAIN via e2e test Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP - Tag: - - Message: -" + Tag: e2e-upload-AGAIN + Message: Upload AGAIN via e2e test" `); expect(countOccurrences(deploymentsList.stdout, versionId0)).toBe(1); // once for regular deploy, only @@ -332,7 +332,8 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { 🤖 Using fallback value in non-interactive context: yes Performing rollback... │ - ╰ SUCCESS Worker Version 00000000-0000-0000-0000-000000000000 has been deployed to 100% of traffic." + ╰ SUCCESS Worker Version 00000000-0000-0000-0000-000000000000 has been deployed to 100% of traffic. + Current Version ID: 00000000-0000-0000-0000-000000000000" `); expect(rollback.stdout).toContain( @@ -344,9 +345,9 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { "Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Unknown (version_upload) - Tag: e2e-upload-AGAIN - Message: Upload AGAIN via e2e test + Source: Upload + Tag: - + Message: - Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com @@ -356,17 +357,25 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Upload - Tag: - - Message: -" + Source: Unknown (version_upload) + Tag: e2e-upload-AGAIN + Message: Upload AGAIN via e2e test" `); // list deployments with new rollback deployment of 1st version (1 new deployment created) expect(normalize(deploymentsList.stdout)).toMatchInlineSnapshot(` "Created: TIMESTAMP Author: person@example.com + Source: Upload + Message: Automatic deployment on upload. + Version(s): (100%) 00000000-0000-0000-0000-000000000000 + Created: TIMESTAMP + Tag: - + Message: - + Created: TIMESTAMP + Author: person@example.com Source: Unknown (deployment) - Message: Rollback via e2e test + Message: Deploy via e2e test Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Tag: e2e-upload @@ -382,19 +391,11 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Created: TIMESTAMP Author: person@example.com Source: Unknown (deployment) - Message: Deploy via e2e test + Message: Rollback via e2e test Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Tag: e2e-upload - Message: Upload via e2e test - Created: TIMESTAMP - Author: person@example.com - Source: Upload - Message: Automatic deployment on upload. - Version(s): (100%) 00000000-0000-0000-0000-000000000000 - Created: TIMESTAMP - Tag: - - Message: -" + Message: Upload via e2e test" `); expect(countOccurrences(deploymentsList.stdout, versionId0)).toBe(1); // once for regular deploy, only @@ -442,7 +443,8 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { 🤖 Using fallback value in non-interactive context: yes Performing rollback... │ - ╰ SUCCESS Worker Version 00000000-0000-0000-0000-000000000000 has been deployed to 100% of traffic." + ╰ SUCCESS Worker Version 00000000-0000-0000-0000-000000000000 has been deployed to 100% of traffic. + Current Version ID: 00000000-0000-0000-0000-000000000000" `); expect(rollback.stdout).toContain( @@ -454,9 +456,9 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { "Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Unknown (version_upload) - Tag: e2e-upload-AGAIN - Message: Upload AGAIN via e2e test + Source: Upload + Tag: - + Message: - Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com @@ -466,17 +468,17 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Version ID: 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Author: person@example.com - Source: Upload - Tag: - - Message: -" + Source: Unknown (version_upload) + Tag: e2e-upload-AGAIN + Message: Upload AGAIN via e2e test" `); // list deployments with new rollback deployment of 0th version (1 new deployment created) expect(normalize(deploymentsList.stdout)).toMatchInlineSnapshot(` "Created: TIMESTAMP Author: person@example.com - Source: Unknown (deployment) - Message: Rollback to old version + Source: Upload + Message: Automatic deployment on upload. Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Tag: - @@ -484,7 +486,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Created: TIMESTAMP Author: person@example.com Source: Unknown (deployment) - Message: Rollback via e2e test + Message: Deploy via e2e test Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Tag: e2e-upload @@ -500,15 +502,15 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Created: TIMESTAMP Author: person@example.com Source: Unknown (deployment) - Message: Deploy via e2e test + Message: Rollback via e2e test Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Tag: e2e-upload Message: Upload via e2e test Created: TIMESTAMP Author: person@example.com - Source: Upload - Message: Automatic deployment on upload. + Source: Unknown (deployment) + Message: Rollback to old version Version(s): (100%) 00000000-0000-0000-0000-000000000000 Created: TIMESTAMP Tag: - diff --git a/packages/wrangler/src/__tests__/deploy.test.ts b/packages/wrangler/src/__tests__/deploy.test.ts index 9dbf799edf54..c3db37d62d5f 100644 --- a/packages/wrangler/src/__tests__/deploy.test.ts +++ b/packages/wrangler/src/__tests__/deploy.test.ts @@ -107,14 +107,10 @@ describe("deploy", () => { "Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev example.com/some-route/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + Current Version ID: Galaxy-Class" `); expect(std.err).toMatchInlineSnapshot(`""`); @@ -171,20 +167,16 @@ describe("deploy", () => { mockSubDomainRequest(); await runWrangler("deploy ./some-path/worker/index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Vars: - - xyz: 123 - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Vars: + - xyz: 123 + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -221,13 +213,9 @@ describe("deploy", () => { - Vars: - xyz: 123 Uploaded test-worker (TIMINGS) - Published test-worker (TIMINGS) + Deployed test-worker triggers (TIMINGS) https://test-worker.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + Current Version ID: Galaxy-Class" `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -265,13 +253,9 @@ describe("deploy", () => { - Vars: - xyz: 123 Uploaded test-worker-jsonc (TIMINGS) - Published test-worker-jsonc (TIMINGS) + Deployed test-worker-jsonc triggers (TIMINGS) https://test-worker-jsonc.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + Current Version ID: Galaxy-Class" `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -348,33 +332,32 @@ describe("deploy", () => { ); writeWorkerSource(); mockSubDomainRequest(); - mockUploadWorkerRequest({ expectedType: "esm" }); + mockUploadWorkerRequest({ + expectedType: "esm", + useOldUploadApi: true, + }); mockOAuthServerCallback(); await runWrangler("deploy ./index"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Worker ID: abc12345 - Worker ETag: etag98765 - Worker PipelineHash: hash9999 - Worker Mutable PipelineID (Development ONLY!): mutableId - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Worker ID: abc12345 + Worker ETag: etag98765 + Worker PipelineHash: hash9999 + Worker Mutable PipelineID (Development ONLY!): mutableId + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); }); @@ -399,20 +382,16 @@ describe("deploy", () => { await expect(runWrangler("deploy index.js")).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "Attempting to login via OAuth... - Opening a link in your default browser: https://dash.cloudflare.com/oauth2/auth?response_type=code&client_id=54d11594-84e4-41aa-b438-e81b8fa78ee7&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread%20user%3Aread%20workers%3Awrite%20workers_kv%3Awrite%20workers_routes%3Awrite%20workers_scripts%3Awrite%20workers_tail%3Aread%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20ai%3Awrite%20queues%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256 - Successfully logged in. - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Attempting to login via OAuth... + Opening a link in your default browser: https://dash.cloudflare.com/oauth2/auth?response_type=code&client_id=54d11594-84e4-41aa-b438-e81b8fa78ee7&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread%20user%3Aread%20workers%3Awrite%20workers_kv%3Awrite%20workers_routes%3Awrite%20workers_scripts%3Awrite%20workers_tail%3Aread%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20ai%3Awrite%20queues%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256 + Successfully logged in. + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.warn).toMatchInlineSnapshot(`""`); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -444,20 +423,16 @@ describe("deploy", () => { expect(accessTokenRequest.actual).toEqual(accessTokenRequest.expected); expect(std.out).toMatchInlineSnapshot(` - "Attempting to login via OAuth... - Opening a link in your default browser: https://dash.staging.cloudflare.com/oauth2/auth?response_type=code&client_id=54d11594-84e4-41aa-b438-e81b8fa78ee7&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread%20user%3Aread%20workers%3Awrite%20workers_kv%3Awrite%20workers_routes%3Awrite%20workers_scripts%3Awrite%20workers_tail%3Aread%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20ai%3Awrite%20queues%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256 - Successfully logged in. - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Attempting to login via OAuth... + Opening a link in your default browser: https://dash.staging.cloudflare.com/oauth2/auth?response_type=code&client_id=54d11594-84e4-41aa-b438-e81b8fa78ee7&redirect_uri=http%3A%2F%2Flocalhost%3A8976%2Foauth%2Fcallback&scope=account%3Aread%20user%3Aread%20workers%3Awrite%20workers_kv%3Awrite%20workers_routes%3Awrite%20workers_scripts%3Awrite%20workers_tail%3Aread%20d1%3Awrite%20pages%3Awrite%20zone%3Aread%20ssl_certs%3Awrite%20ai%3Awrite%20queues%3Awrite%20offline_access&state=MOCK_STATE_PARAM&code_challenge=MOCK_CODE_CHALLENGE&code_challenge_method=S256 + Successfully logged in. + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.warn).toMatchInlineSnapshot(`""`); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -475,17 +450,13 @@ describe("deploy", () => { await expect(runWrangler("deploy index.js")).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] It looks like you have used Wrangler v1's \`config\` command to login with an API token. @@ -513,17 +484,13 @@ describe("deploy", () => { await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -541,17 +508,13 @@ describe("deploy", () => { await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -724,17 +687,13 @@ describe("deploy", () => { await runWrangler("deploy index.js --env some-env"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-some-env (TIMINGS) - Published test-name-some-env (TIMINGS) - https://test-name-some-env.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-some-env (TIMINGS) + Deployed test-name-some-env triggers (TIMINGS) + https://test-name-some-env.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -750,17 +709,13 @@ describe("deploy", () => { await runWrangler("deploy index.js --legacy-env true"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -776,17 +731,13 @@ describe("deploy", () => { await runWrangler("deploy index.js --env some-env --legacy-env true"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-some-env (TIMINGS) - Published test-name-some-env (TIMINGS) - https://test-name-some-env.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-some-env (TIMINGS) + Deployed test-name-some-env triggers (TIMINGS) + https://test-name-some-env.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -802,17 +753,13 @@ describe("deploy", () => { await runWrangler("deploy index.js --env some-env --legacy-env true"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-some-env (TIMINGS) - Published test-name-some-env (TIMINGS) - https://test-name-some-env.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-some-env (TIMINGS) + Deployed test-name-some-env triggers (TIMINGS) + https://test-name-some-env.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -879,17 +826,13 @@ describe("deploy", () => { await runWrangler("deploy index.js --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -908,21 +851,18 @@ describe("deploy", () => { mockUploadWorkerRequest({ env: "some-env", legacyEnv: false, + useOldUploadApi: true, }); await runWrangler("deploy index.js --env some-env --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (some-env) (TIMINGS) - Published test-name (some-env) (TIMINGS) - https://some-env.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (some-env) (TIMINGS) + Deployed test-name (some-env) triggers (TIMINGS) + https://some-env.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -961,20 +901,16 @@ describe("deploy", () => { mockSubDomainRequest(); await runWrangler("deploy ./some-path/worker/index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Vars: - - xyz: 123 - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Vars: + - xyz: 123 + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1001,28 +937,24 @@ describe("deploy", () => { mockPublishRoutesRequest({ routes: [] }); await runWrangler("deploy ./index"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "▲ [WARNING] Processing wrangler.toml configuration: + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "▲ [WARNING] Processing wrangler.toml configuration: - - The \\"route\\" field in your configuration is an empty string and will be ignored. - Please remove the \\"route\\" field from your configuration. + - The \\"route\\" field in your configuration is an empty string and will be ignored. + Please remove the \\"route\\" field from your configuration. - ", - } - `); + ", + } + `); }); it("should deploy to a route with a pattern/{zone_id|zone_name} combo", async () => { writeWranglerToml({ @@ -1054,27 +986,23 @@ describe("deploy", () => { }); await runWrangler("deploy ./index"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - some-example.com/some-route/* - *a-boring-website.com (zone id: 54sdf7fsda) - *another-boring-website.com (zone name: some-zone.com) - example.com/some-route/* (zone id: JGHFHG654gjcj) - more-examples.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + some-example.com/some-route/* + *a-boring-website.com (zone id: 54sdf7fsda) + *another-boring-website.com (zone name: some-zone.com) + example.com/some-route/* (zone id: JGHFHG654gjcj) + more-examples.com/* + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should deploy to a route with a SaaS domain", async () => { @@ -1102,23 +1030,19 @@ describe("deploy", () => { }); await runWrangler("deploy ./index"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - partner.com/* (zone name: owned-zone.com) - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + partner.com/* (zone name: owned-zone.com) + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should deploy to a route with a SaaS subdomain", async () => { @@ -1146,23 +1070,19 @@ describe("deploy", () => { }); await runWrangler("deploy ./index"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - subdomain.partner.com/* (zone name: owned-zone.com) - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + subdomain.partner.com/* (zone name: owned-zone.com) + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should deploy to a route with a pattern/{zone_id|zone_name} combo (service environments)", async () => { @@ -1193,6 +1113,7 @@ describe("deploy", () => { expectedType: "esm", env: "staging", legacyEnv: false, + useOldUploadApi: true, }); mockPublishRoutesRequest({ routes: [ @@ -1210,32 +1131,28 @@ describe("deploy", () => { }); await runWrangler("deploy ./index --legacy-env false --env staging"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (staging) (TIMINGS) - Published test-name (staging) (TIMINGS) - some-example.com/some-route/* - *a-boring-website.com (zone id: 54sdf7fsda) - *another-boring-website.com (zone name: some-zone.com) - example.com/some-route/* (zone id: JGHFHG654gjcj) - more-examples.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "▲ [WARNING] Processing wrangler.toml configuration: + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (staging) (TIMINGS) + Deployed test-name (staging) triggers (TIMINGS) + some-example.com/some-route/* + *a-boring-website.com (zone id: 54sdf7fsda) + *another-boring-website.com (zone name: some-zone.com) + example.com/some-route/* (zone id: JGHFHG654gjcj) + more-examples.com/* + Current Version ID: Galaxy-Class", + "warn": "▲ [WARNING] Processing wrangler.toml configuration: - - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in - the future. DO NOT USE IN PRODUCTION. + - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in + the future. DO NOT USE IN PRODUCTION. - ", - } - `); + ", + } + `); }); it("should deploy to legacy environment specific routes", async () => { @@ -1326,17 +1243,13 @@ describe("deploy", () => { " `); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - example.com/some-route/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + example.com/some-route/* + Current Version ID: Galaxy-Class" + `); }); it("should error if the bulk-routes API fails and trying to push to a non-production environment", async () => { @@ -1614,40 +1527,35 @@ Update them to point to this script instead?`, await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); it("should be able to use `index` with no extension as the entry-point (sw)", async () => { writeWranglerToml(); writeWorkerSource({ type: "sw" }); - mockUploadWorkerRequest({ expectedType: "sw" }); + mockUploadWorkerRequest({ + expectedType: "sw", + useOldUploadApi: true, + }); mockSubDomainRequest(); await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1660,17 +1568,13 @@ Update them to point to this script instead?`, await runWrangler("deploy"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1685,17 +1589,13 @@ Update them to point to this script instead?`, await runWrangler("deploy"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1708,17 +1608,13 @@ Update them to point to this script instead?`, await runWrangler("deploy"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -1750,17 +1646,13 @@ Update them to point to this script instead?`, await runWrangler("deploy"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing ../wrangler.toml configuration: @@ -1806,17 +1698,13 @@ Update them to point to this script instead?`, await runWrangler("deploy index.ts"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1826,22 +1714,19 @@ Update them to point to this script instead?`, mockUploadWorkerRequest({ expectedEntry: "var foo = 100;", expectedType: "sw", + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy index.ts"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1868,17 +1753,13 @@ export default{ mockSubDomainRequest(); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1899,17 +1780,13 @@ export default{ mockSubDomainRequest(); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -1922,17 +1799,13 @@ export default{ await runWrangler("deploy ./src/index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -2018,23 +1891,20 @@ addEventListener('fetch', event => {});` mockUploadWorkerRequest({ expectedEntry: "var foo = 100;", expectedType: "sw", + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy ./src/index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -2101,38 +1971,34 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index.js"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "Fetching list of already uploaded assets... - Building list of assets to upload... - + file-1.2ca234f380.txt (uploading new version of file-1.txt) - + file-2.5938485188.txt (uploading new version of file-2.txt) - Uploading 2 new assets... - Uploaded 100% [2 out of 2]", - "out": "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "▲ [WARNING] Processing wrangler.toml configuration: + Object { + "debug": "", + "err": "", + "info": "Fetching list of already uploaded assets... + Building list of assets to upload... + + file-1.2ca234f380.txt (uploading new version of file-1.txt) + + file-2.5938485188.txt (uploading new version of file-2.txt) + Uploading 2 new assets... + Uploaded 100% [2 out of 2]", + "out": "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "▲ [WARNING] Processing wrangler.toml configuration: - - Deprecation: \\"site.entry-point\\": - Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration - file: - \`\`\` - main = \\"index.js\\" - \`\`\` + - Deprecation: \\"site.entry-point\\": + Delete the \`site.entry-point\` field, then add the top level \`main\` field to your configuration + file: + \`\`\` + main = \\"index.js\\" + \`\`\` - ", - } - `); + ", + } + `); }); it("should resolve site.entry-point relative to wrangler.toml", async () => { @@ -2172,18 +2038,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [2 out of 2]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(normalizeSlashes(std.warn)).toMatchInlineSnapshot(` "▲ [WARNING] Processing my-site/wrangler.toml configuration: @@ -2272,13 +2134,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", + Current Version ID: Galaxy-Class", "warn": "▲ [WARNING] The --legacy-assets argument is experimental and may change or break at any time. @@ -2293,8 +2151,8 @@ addEventListener('fetch', event => {});` describe("should source map validation errors", () => { function mockDeployWithValidationError(message: string) { - const handler = http.put( - "*/accounts/:accountId/workers/scripts/:scriptName", + const handler = http.post( + "*/accounts/:accountId/workers/scripts/:scriptName/versions", async () => { const body = createFetchResult(null, false, [ { code: 10021, message }, @@ -2439,18 +2297,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [2 out of 2]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -2491,13 +2345,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", + Current Version ID: Galaxy-Class", "warn": "▲ [WARNING] The --legacy-assets argument is experimental and may change or break at any time. ", @@ -2542,13 +2392,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", + Current Version ID: Galaxy-Class", "warn": "▲ [WARNING] The --assets argument is experimental. We are going to be changing the behavior of this experimental command after August 15th. Releases of wrangler after this date will no longer support current functionality. @@ -2742,13 +2588,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", + Current Version ID: Galaxy-Class", "warn": "▲ [WARNING] The --legacy-assets argument is experimental and may change or break at any time. ", @@ -2795,13 +2637,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", + Current Version ID: Galaxy-Class", "warn": "▲ [WARNING] Processing wrangler.toml configuration: - \\"legacy_assets\\" fields are experimental and may change or break at any time. @@ -2857,18 +2695,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [2 out of 2]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -2907,6 +2741,7 @@ addEventListener('fetch', event => {});` type: "text_blob", }, ], + useOldUploadApi: true, }); mockSubDomainRequest(); mockListKVNamespacesRequest(kvNamespace); @@ -2924,18 +2759,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [2 out of 2]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3046,13 +2877,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + Current Version ID: Galaxy-Class" `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3085,6 +2912,7 @@ addEventListener('fetch', event => {});` type: "kv_namespace", }, ], + useOldUploadApi: true, }); mockSubDomainRequest(); mockListKVNamespacesRequest(kvNamespace); @@ -3101,18 +2929,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [2 out of 2]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (some-env) (TIMINGS) - Published test-name (some-env) (TIMINGS) - https://some-env.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (some-env) (TIMINGS) + Deployed test-name (some-env) triggers (TIMINGS) + https://some-env.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3161,18 +2985,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [2 out of 2]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-some-env (TIMINGS) - Published test-name-some-env (TIMINGS) - https://test-name-some-env.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-some-env (TIMINGS) + Deployed test-name-some-env triggers (TIMINGS) + https://test-name-some-env.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3206,18 +3026,14 @@ addEventListener('fetch', event => {});` await runWrangler("deploy"); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3257,18 +3073,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3308,18 +3120,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3360,18 +3168,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3412,18 +3216,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3464,18 +3264,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3516,18 +3312,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3570,18 +3362,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3628,18 +3416,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [1 out of 1]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3742,18 +3526,14 @@ addEventListener('fetch', event => {});` expect(std.debug).toMatchInlineSnapshot(`""`); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); // Mask all but last upload progress message as upload order unknown // (regexp replaces all single/double-digit percentages, i.e. not 100%) expect(std.info.replace(/Uploaded \d\d?% \[\d+/g, "Uploaded X% [X")) @@ -3885,18 +3665,14 @@ addEventListener('fetch', event => {});` Removing 2 stale assets..." `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3949,18 +3725,14 @@ addEventListener('fetch', event => {});` Uploaded 100% [2 out of 2]" `); expect(std.out).toMatchInlineSnapshot(` - "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -3989,29 +3761,25 @@ addEventListener('fetch', event => {});` await runWrangler("deploy --site ."); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "Fetching list of already uploaded assets... - Building list of assets to upload... - + file-1.2ca234f380.txt (uploading new version of file-1.txt) - + file-2.5938485188.txt (uploading new version of file-2.txt) - Uploading 2 new assets... - Uploaded 100% [2 out of 2]", - "out": "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "Fetching list of already uploaded assets... + Building list of assets to upload... + + file-1.2ca234f380.txt (uploading new version of file-1.txt) + + file-2.5938485188.txt (uploading new version of file-2.txt) + Uploading 2 new assets... + Uploaded 100% [2 out of 2]", + "out": "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should use the relative path from current working directory to Worker directory when using `--legacy-assets`", async () => { @@ -4052,13 +3820,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", + Current Version ID: Galaxy-Class", "warn": "▲ [WARNING] The --legacy-assets argument is experimental and may change or break at any time. ", @@ -4161,12 +3925,137 @@ addEventListener('fetch', event => {});` it("default log level", async () => { await runWrangler("deploy"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "Fetching list of already uploaded assets... - Building list of assets to upload... - + file-000.010257e8bb.txt (uploading new version of file-000.txt) + Object { + "debug": "", + "err": "", + "info": "Fetching list of already uploaded assets... + Building list of assets to upload... + + file-000.010257e8bb.txt (uploading new version of file-000.txt) + + file-001.010257e8bb.txt (uploading new version of file-001.txt) + + file-002.010257e8bb.txt (uploading new version of file-002.txt) + + file-003.010257e8bb.txt (uploading new version of file-003.txt) + + file-004.010257e8bb.txt (uploading new version of file-004.txt) + + file-005.010257e8bb.txt (uploading new version of file-005.txt) + + file-006.010257e8bb.txt (uploading new version of file-006.txt) + + file-007.010257e8bb.txt (uploading new version of file-007.txt) + + file-008.010257e8bb.txt (uploading new version of file-008.txt) + + file-009.010257e8bb.txt (uploading new version of file-009.txt) + + file-010.010257e8bb.txt (uploading new version of file-010.txt) + + file-011.010257e8bb.txt (uploading new version of file-011.txt) + + file-012.010257e8bb.txt (uploading new version of file-012.txt) + + file-013.010257e8bb.txt (uploading new version of file-013.txt) + + file-014.010257e8bb.txt (uploading new version of file-014.txt) + + file-015.010257e8bb.txt (uploading new version of file-015.txt) + + file-016.010257e8bb.txt (uploading new version of file-016.txt) + + file-017.010257e8bb.txt (uploading new version of file-017.txt) + + file-018.010257e8bb.txt (uploading new version of file-018.txt) + + file-019.010257e8bb.txt (uploading new version of file-019.txt) + + file-020.010257e8bb.txt (uploading new version of file-020.txt) + + file-021.010257e8bb.txt (uploading new version of file-021.txt) + + file-022.010257e8bb.txt (uploading new version of file-022.txt) + + file-023.010257e8bb.txt (uploading new version of file-023.txt) + + file-024.010257e8bb.txt (uploading new version of file-024.txt) + + file-025.010257e8bb.txt (uploading new version of file-025.txt) + + file-026.010257e8bb.txt (uploading new version of file-026.txt) + + file-027.010257e8bb.txt (uploading new version of file-027.txt) + + file-028.010257e8bb.txt (uploading new version of file-028.txt) + + file-029.010257e8bb.txt (uploading new version of file-029.txt) + + file-030.010257e8bb.txt (uploading new version of file-030.txt) + + file-031.010257e8bb.txt (uploading new version of file-031.txt) + + file-032.010257e8bb.txt (uploading new version of file-032.txt) + + file-033.010257e8bb.txt (uploading new version of file-033.txt) + + file-034.010257e8bb.txt (uploading new version of file-034.txt) + + file-035.010257e8bb.txt (uploading new version of file-035.txt) + + file-036.010257e8bb.txt (uploading new version of file-036.txt) + + file-037.010257e8bb.txt (uploading new version of file-037.txt) + + file-038.010257e8bb.txt (uploading new version of file-038.txt) + + file-039.010257e8bb.txt (uploading new version of file-039.txt) + + file-040.010257e8bb.txt (uploading new version of file-040.txt) + + file-041.010257e8bb.txt (uploading new version of file-041.txt) + + file-042.010257e8bb.txt (uploading new version of file-042.txt) + + file-043.010257e8bb.txt (uploading new version of file-043.txt) + + file-044.010257e8bb.txt (uploading new version of file-044.txt) + + file-045.010257e8bb.txt (uploading new version of file-045.txt) + + file-046.010257e8bb.txt (uploading new version of file-046.txt) + + file-047.010257e8bb.txt (uploading new version of file-047.txt) + + file-048.010257e8bb.txt (uploading new version of file-048.txt) + + file-049.010257e8bb.txt (uploading new version of file-049.txt) + + file-050.010257e8bb.txt (uploading new version of file-050.txt) + + file-051.010257e8bb.txt (uploading new version of file-051.txt) + + file-052.010257e8bb.txt (uploading new version of file-052.txt) + + file-053.010257e8bb.txt (uploading new version of file-053.txt) + + file-054.010257e8bb.txt (uploading new version of file-054.txt) + + file-055.010257e8bb.txt (uploading new version of file-055.txt) + + file-056.010257e8bb.txt (uploading new version of file-056.txt) + + file-057.010257e8bb.txt (uploading new version of file-057.txt) + + file-058.010257e8bb.txt (uploading new version of file-058.txt) + + file-059.010257e8bb.txt (uploading new version of file-059.txt) + + file-060.010257e8bb.txt (uploading new version of file-060.txt) + + file-061.010257e8bb.txt (uploading new version of file-061.txt) + + file-062.010257e8bb.txt (uploading new version of file-062.txt) + + file-063.010257e8bb.txt (uploading new version of file-063.txt) + + file-064.010257e8bb.txt (uploading new version of file-064.txt) + + file-065.010257e8bb.txt (uploading new version of file-065.txt) + + file-066.010257e8bb.txt (uploading new version of file-066.txt) + + file-067.010257e8bb.txt (uploading new version of file-067.txt) + + file-068.010257e8bb.txt (uploading new version of file-068.txt) + + file-069.010257e8bb.txt (uploading new version of file-069.txt) + + file-070.010257e8bb.txt (uploading new version of file-070.txt) + + file-071.010257e8bb.txt (uploading new version of file-071.txt) + + file-072.010257e8bb.txt (uploading new version of file-072.txt) + + file-073.010257e8bb.txt (uploading new version of file-073.txt) + + file-074.010257e8bb.txt (uploading new version of file-074.txt) + + file-075.010257e8bb.txt (uploading new version of file-075.txt) + + file-076.010257e8bb.txt (uploading new version of file-076.txt) + + file-077.010257e8bb.txt (uploading new version of file-077.txt) + + file-078.010257e8bb.txt (uploading new version of file-078.txt) + + file-079.010257e8bb.txt (uploading new version of file-079.txt) + + file-080.010257e8bb.txt (uploading new version of file-080.txt) + + file-081.010257e8bb.txt (uploading new version of file-081.txt) + + file-082.010257e8bb.txt (uploading new version of file-082.txt) + + file-083.010257e8bb.txt (uploading new version of file-083.txt) + + file-084.010257e8bb.txt (uploading new version of file-084.txt) + + file-085.010257e8bb.txt (uploading new version of file-085.txt) + + file-086.010257e8bb.txt (uploading new version of file-086.txt) + + file-087.010257e8bb.txt (uploading new version of file-087.txt) + + file-088.010257e8bb.txt (uploading new version of file-088.txt) + + file-089.010257e8bb.txt (uploading new version of file-089.txt) + + file-090.010257e8bb.txt (uploading new version of file-090.txt) + + file-091.010257e8bb.txt (uploading new version of file-091.txt) + + file-092.010257e8bb.txt (uploading new version of file-092.txt) + + file-093.010257e8bb.txt (uploading new version of file-093.txt) + + file-094.010257e8bb.txt (uploading new version of file-094.txt) + + file-095.010257e8bb.txt (uploading new version of file-095.txt) + + file-096.010257e8bb.txt (uploading new version of file-096.txt) + + file-097.010257e8bb.txt (uploading new version of file-097.txt) + + file-098.010257e8bb.txt (uploading new version of file-098.txt) + + file-099.010257e8bb.txt (uploading new version of file-099.txt) + (truncating changed assets log, set \`WRANGLER_LOG=debug\` environment variable to see full diff) + Uploading 110 new assets... + Uploaded 100% [110 out of 110]", + "out": "↗️ Done syncing assets + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); + }); + + it("debug log level", async () => { + logger.loggerLevel = "debug"; + await runWrangler("deploy"); + + const diffRegexp = /^ [+=-]/; + const diff = std.debug + .split("\n") + .filter((line) => diffRegexp.test(line)) + .join("\n"); + expect(diff).toMatchInlineSnapshot(` + " + file-000.010257e8bb.txt (uploading new version of file-000.txt) + file-001.010257e8bb.txt (uploading new version of file-001.txt) + file-002.010257e8bb.txt (uploading new version of file-002.txt) + file-003.010257e8bb.txt (uploading new version of file-003.txt) @@ -4266,187 +4155,58 @@ addEventListener('fetch', event => {});` + file-097.010257e8bb.txt (uploading new version of file-097.txt) + file-098.010257e8bb.txt (uploading new version of file-098.txt) + file-099.010257e8bb.txt (uploading new version of file-099.txt) - (truncating changed assets log, set \`WRANGLER_LOG=debug\` environment variable to see full diff) + + file-100.010257e8bb.txt (uploading new version of file-100.txt) + + file-101.010257e8bb.txt (uploading new version of file-101.txt) + + file-102.010257e8bb.txt (uploading new version of file-102.txt) + + file-103.010257e8bb.txt (uploading new version of file-103.txt) + + file-104.010257e8bb.txt (uploading new version of file-104.txt) + + file-105.010257e8bb.txt (uploading new version of file-105.txt) + + file-106.010257e8bb.txt (uploading new version of file-106.txt) + + file-107.010257e8bb.txt (uploading new version of file-107.txt) + + file-108.010257e8bb.txt (uploading new version of file-108.txt) + + file-109.010257e8bb.txt (uploading new version of file-109.txt)" + `); + expect(std.info).toMatchInlineSnapshot(` + "Fetching list of already uploaded assets... + Building list of assets to upload... Uploading 110 new assets... - Uploaded 100% [110 out of 110]", - "out": "↗️ Done syncing assets - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } + Uploaded 100% [110 out of 110]" `); }); + }); + }); - it("debug log level", async () => { - logger.loggerLevel = "debug"; - await runWrangler("deploy"); - - const diffRegexp = /^ [+=-]/; - const diff = std.debug - .split("\n") - .filter((line) => diffRegexp.test(line)) - .join("\n"); - expect(diff).toMatchInlineSnapshot(` - " + file-000.010257e8bb.txt (uploading new version of file-000.txt) - + file-001.010257e8bb.txt (uploading new version of file-001.txt) - + file-002.010257e8bb.txt (uploading new version of file-002.txt) - + file-003.010257e8bb.txt (uploading new version of file-003.txt) - + file-004.010257e8bb.txt (uploading new version of file-004.txt) - + file-005.010257e8bb.txt (uploading new version of file-005.txt) - + file-006.010257e8bb.txt (uploading new version of file-006.txt) - + file-007.010257e8bb.txt (uploading new version of file-007.txt) - + file-008.010257e8bb.txt (uploading new version of file-008.txt) - + file-009.010257e8bb.txt (uploading new version of file-009.txt) - + file-010.010257e8bb.txt (uploading new version of file-010.txt) - + file-011.010257e8bb.txt (uploading new version of file-011.txt) - + file-012.010257e8bb.txt (uploading new version of file-012.txt) - + file-013.010257e8bb.txt (uploading new version of file-013.txt) - + file-014.010257e8bb.txt (uploading new version of file-014.txt) - + file-015.010257e8bb.txt (uploading new version of file-015.txt) - + file-016.010257e8bb.txt (uploading new version of file-016.txt) - + file-017.010257e8bb.txt (uploading new version of file-017.txt) - + file-018.010257e8bb.txt (uploading new version of file-018.txt) - + file-019.010257e8bb.txt (uploading new version of file-019.txt) - + file-020.010257e8bb.txt (uploading new version of file-020.txt) - + file-021.010257e8bb.txt (uploading new version of file-021.txt) - + file-022.010257e8bb.txt (uploading new version of file-022.txt) - + file-023.010257e8bb.txt (uploading new version of file-023.txt) - + file-024.010257e8bb.txt (uploading new version of file-024.txt) - + file-025.010257e8bb.txt (uploading new version of file-025.txt) - + file-026.010257e8bb.txt (uploading new version of file-026.txt) - + file-027.010257e8bb.txt (uploading new version of file-027.txt) - + file-028.010257e8bb.txt (uploading new version of file-028.txt) - + file-029.010257e8bb.txt (uploading new version of file-029.txt) - + file-030.010257e8bb.txt (uploading new version of file-030.txt) - + file-031.010257e8bb.txt (uploading new version of file-031.txt) - + file-032.010257e8bb.txt (uploading new version of file-032.txt) - + file-033.010257e8bb.txt (uploading new version of file-033.txt) - + file-034.010257e8bb.txt (uploading new version of file-034.txt) - + file-035.010257e8bb.txt (uploading new version of file-035.txt) - + file-036.010257e8bb.txt (uploading new version of file-036.txt) - + file-037.010257e8bb.txt (uploading new version of file-037.txt) - + file-038.010257e8bb.txt (uploading new version of file-038.txt) - + file-039.010257e8bb.txt (uploading new version of file-039.txt) - + file-040.010257e8bb.txt (uploading new version of file-040.txt) - + file-041.010257e8bb.txt (uploading new version of file-041.txt) - + file-042.010257e8bb.txt (uploading new version of file-042.txt) - + file-043.010257e8bb.txt (uploading new version of file-043.txt) - + file-044.010257e8bb.txt (uploading new version of file-044.txt) - + file-045.010257e8bb.txt (uploading new version of file-045.txt) - + file-046.010257e8bb.txt (uploading new version of file-046.txt) - + file-047.010257e8bb.txt (uploading new version of file-047.txt) - + file-048.010257e8bb.txt (uploading new version of file-048.txt) - + file-049.010257e8bb.txt (uploading new version of file-049.txt) - + file-050.010257e8bb.txt (uploading new version of file-050.txt) - + file-051.010257e8bb.txt (uploading new version of file-051.txt) - + file-052.010257e8bb.txt (uploading new version of file-052.txt) - + file-053.010257e8bb.txt (uploading new version of file-053.txt) - + file-054.010257e8bb.txt (uploading new version of file-054.txt) - + file-055.010257e8bb.txt (uploading new version of file-055.txt) - + file-056.010257e8bb.txt (uploading new version of file-056.txt) - + file-057.010257e8bb.txt (uploading new version of file-057.txt) - + file-058.010257e8bb.txt (uploading new version of file-058.txt) - + file-059.010257e8bb.txt (uploading new version of file-059.txt) - + file-060.010257e8bb.txt (uploading new version of file-060.txt) - + file-061.010257e8bb.txt (uploading new version of file-061.txt) - + file-062.010257e8bb.txt (uploading new version of file-062.txt) - + file-063.010257e8bb.txt (uploading new version of file-063.txt) - + file-064.010257e8bb.txt (uploading new version of file-064.txt) - + file-065.010257e8bb.txt (uploading new version of file-065.txt) - + file-066.010257e8bb.txt (uploading new version of file-066.txt) - + file-067.010257e8bb.txt (uploading new version of file-067.txt) - + file-068.010257e8bb.txt (uploading new version of file-068.txt) - + file-069.010257e8bb.txt (uploading new version of file-069.txt) - + file-070.010257e8bb.txt (uploading new version of file-070.txt) - + file-071.010257e8bb.txt (uploading new version of file-071.txt) - + file-072.010257e8bb.txt (uploading new version of file-072.txt) - + file-073.010257e8bb.txt (uploading new version of file-073.txt) - + file-074.010257e8bb.txt (uploading new version of file-074.txt) - + file-075.010257e8bb.txt (uploading new version of file-075.txt) - + file-076.010257e8bb.txt (uploading new version of file-076.txt) - + file-077.010257e8bb.txt (uploading new version of file-077.txt) - + file-078.010257e8bb.txt (uploading new version of file-078.txt) - + file-079.010257e8bb.txt (uploading new version of file-079.txt) - + file-080.010257e8bb.txt (uploading new version of file-080.txt) - + file-081.010257e8bb.txt (uploading new version of file-081.txt) - + file-082.010257e8bb.txt (uploading new version of file-082.txt) - + file-083.010257e8bb.txt (uploading new version of file-083.txt) - + file-084.010257e8bb.txt (uploading new version of file-084.txt) - + file-085.010257e8bb.txt (uploading new version of file-085.txt) - + file-086.010257e8bb.txt (uploading new version of file-086.txt) - + file-087.010257e8bb.txt (uploading new version of file-087.txt) - + file-088.010257e8bb.txt (uploading new version of file-088.txt) - + file-089.010257e8bb.txt (uploading new version of file-089.txt) - + file-090.010257e8bb.txt (uploading new version of file-090.txt) - + file-091.010257e8bb.txt (uploading new version of file-091.txt) - + file-092.010257e8bb.txt (uploading new version of file-092.txt) - + file-093.010257e8bb.txt (uploading new version of file-093.txt) - + file-094.010257e8bb.txt (uploading new version of file-094.txt) - + file-095.010257e8bb.txt (uploading new version of file-095.txt) - + file-096.010257e8bb.txt (uploading new version of file-096.txt) - + file-097.010257e8bb.txt (uploading new version of file-097.txt) - + file-098.010257e8bb.txt (uploading new version of file-098.txt) - + file-099.010257e8bb.txt (uploading new version of file-099.txt) - + file-100.010257e8bb.txt (uploading new version of file-100.txt) - + file-101.010257e8bb.txt (uploading new version of file-101.txt) - + file-102.010257e8bb.txt (uploading new version of file-102.txt) - + file-103.010257e8bb.txt (uploading new version of file-103.txt) - + file-104.010257e8bb.txt (uploading new version of file-104.txt) - + file-105.010257e8bb.txt (uploading new version of file-105.txt) - + file-106.010257e8bb.txt (uploading new version of file-106.txt) - + file-107.010257e8bb.txt (uploading new version of file-107.txt) - + file-108.010257e8bb.txt (uploading new version of file-108.txt) - + file-109.010257e8bb.txt (uploading new version of file-109.txt)" - `); - expect(std.info).toMatchInlineSnapshot(` - "Fetching list of already uploaded assets... - Building list of assets to upload... - Uploading 110 new assets... - Uploaded 100% [110 out of 110]" - `); - }); - }); - }); - - describe("--experimental-assets", () => { - it("should use the directory specified in the CLI over wrangler.toml", async () => { - const cliAssets = [ - { filePath: "cliAsset.txt", content: "Content of file-1" }, - ]; - writeAssets(cliAssets, "cli-assets"); - const configAssets = [ - { filePath: "configAsset.txt", content: "Content of file-2" }, - ]; - writeAssets(configAssets, "config-assets"); - writeWranglerToml({ - experimental_assets: { directory: "config-assets" }, - }); - const bodies: AssetManifest[] = []; - await mockAUSRequest(bodies); - mockSubDomainRequest(); - mockUploadWorkerRequest({ - expectedExperimentalAssets: true, - expectedType: "none", - }); - await runWrangler("deploy --experimental-assets cli-assets"); - expect(bodies.length).toBe(1); - expect(bodies[0]).toEqual({ - manifest: { - "/cliAsset.txt": { - hash: "0de3dd5df907418e9730fd2bd747bd5e", - size: 17, - }, - }, - }); - }); + describe("--experimental-assets", () => { + it("should use the directory specified in the CLI over wrangler.toml", async () => { + const cliAssets = [ + { filePath: "cliAsset.txt", content: "Content of file-1" }, + ]; + writeAssets(cliAssets, "cli-assets"); + const configAssets = [ + { filePath: "configAsset.txt", content: "Content of file-2" }, + ]; + writeAssets(configAssets, "config-assets"); + writeWranglerToml({ + experimental_assets: { directory: "config-assets" }, + }); + const bodies: AssetManifest[] = []; + await mockAUSRequest(bodies); + mockSubDomainRequest(); + mockUploadWorkerRequest({ + expectedExperimentalAssets: true, + expectedType: "none", + }); + await runWrangler("deploy --experimental-assets cli-assets"); + expect(bodies.length).toBe(1); + expect(bodies[0]).toEqual({ + manifest: { + "/cliAsset.txt": { + hash: "0de3dd5df907418e9730fd2bd747bd5e", + size: 17, + }, + }, + }); + }); it("should error if config.site and config.experimental_assets are used together", async () => { writeWranglerToml({ @@ -4832,17 +4592,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -4858,17 +4614,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -4883,17 +4635,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -4908,16 +4656,12 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - No deploy targets for test-name (TIMINGS) - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + No deploy targets for test-name (TIMINGS) + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -4934,16 +4678,12 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - No deploy targets for test-name (TIMINGS) - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + No deploy targets for test-name (TIMINGS) + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -4958,22 +4698,19 @@ addEventListener('fetch', event => {});` writeWorkerSource(); mockUploadWorkerRequest({ env: "dev", + useOldUploadApi: true, }); mockUpdateWorkerRequest({ enabled: false, env: "dev" }); await runWrangler("deploy ./index --env dev --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (dev) (TIMINGS) - No deploy targets for test-name (dev) (TIMINGS) - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (dev) (TIMINGS) + No deploy targets for test-name (dev) (TIMINGS) + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -4995,16 +4732,12 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index --env dev --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (dev) (TIMINGS) - No deploy targets for test-name (dev) (TIMINGS) - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (dev) (TIMINGS) + No deploy targets for test-name (dev) (TIMINGS) + Current Version ID: undefined" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5019,6 +4752,7 @@ addEventListener('fetch', event => {});` writeWorkerSource(); mockUploadWorkerRequest({ env: "dev", + useOldUploadApi: true, }); mockSubDomainRequest(); mockUpdateWorkerRequest({ enabled: true, env: "dev" }); @@ -5026,17 +4760,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index --env dev --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (dev) (TIMINGS) - Published test-name (dev) (TIMINGS) - https://dev.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (dev) (TIMINGS) + Deployed test-name (dev) triggers (TIMINGS) + https://dev.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5052,6 +4782,7 @@ addEventListener('fetch', event => {});` writeWorkerSource(); mockUploadWorkerRequest({ env: "dev", + useOldUploadApi: true, }); mockSubDomainRequest(); mockUpdateWorkerRequest({ enabled: true, env: "dev" }); @@ -5059,17 +4790,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index --env dev --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (dev) (TIMINGS) - Published test-name (dev) (TIMINGS) - https://dev.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (dev) (TIMINGS) + Deployed test-name (dev) triggers (TIMINGS) + https://dev.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5086,6 +4813,7 @@ addEventListener('fetch', event => {});` env: "dev", expectedCompatibilityDate: "2022-01-12", expectedCompatibilityFlags: ["no_global_navigator"], + useOldUploadApi: true, }); mockSubDomainRequest(); mockUpdateWorkerRequest({ enabled: true, env: "dev" }); @@ -5093,17 +4821,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index --env dev --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (dev) (TIMINGS) - Published test-name (dev) (TIMINGS) - https://dev.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (dev) (TIMINGS) + Deployed test-name (dev) triggers (TIMINGS) + https://dev.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5123,6 +4847,7 @@ addEventListener('fetch', event => {});` env: "dev", expectedCompatibilityDate: "2022-01-13", expectedCompatibilityFlags: ["global_navigator"], + useOldUploadApi: true, }); mockSubDomainRequest(); mockUpdateWorkerRequest({ enabled: true, env: "dev" }); @@ -5130,17 +4855,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index --env dev --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (dev) (TIMINGS) - Published test-name (dev) (TIMINGS) - https://dev.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (dev) (TIMINGS) + Deployed test-name (dev) triggers (TIMINGS) + https://dev.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5169,17 +4890,13 @@ addEventListener('fetch', event => {});` ); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (dev) (TIMINGS) - Published test-name (dev) (TIMINGS) - https://dev.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (dev) (TIMINGS) + Deployed test-name (dev) triggers (TIMINGS) + https://dev.test-name.test-sub-domain.workers.dev + Current Version ID: undefined" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5235,17 +4952,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5259,17 +4972,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy ./index"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5340,17 +5049,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - http://example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + http://example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5380,17 +5085,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js --env production"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-production (TIMINGS) - Published test-name-production (TIMINGS) - http://production.example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-production (TIMINGS) + Deployed test-name-production triggers (TIMINGS) + http://production.example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5419,17 +5120,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js --env production"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-production (TIMINGS) - Published test-name-production (TIMINGS) - http://production.example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-production (TIMINGS) + Deployed test-name-production triggers (TIMINGS) + http://production.example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5451,18 +5148,14 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - http://example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + http://example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5492,18 +5185,14 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js --env production"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-production (TIMINGS) - Published test-name-production (TIMINGS) - https://test-name-production.test-sub-domain.workers.dev - http://production.example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-production (TIMINGS) + Deployed test-name-production triggers (TIMINGS) + https://test-name-production.test-sub-domain.workers.dev + http://production.example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5533,18 +5222,14 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js --env production"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-production (TIMINGS) - Published test-name-production (TIMINGS) - https://test-name-production.test-sub-domain.workers.dev - http://production.example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-production (TIMINGS) + Deployed test-name-production triggers (TIMINGS) + https://test-name-production.test-sub-domain.workers.dev + http://production.example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5574,17 +5259,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js --env production"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-production (TIMINGS) - Published test-name-production (TIMINGS) - http://production.example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-production (TIMINGS) + Deployed test-name-production triggers (TIMINGS) + http://production.example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5614,17 +5295,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js --env production"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name-production (TIMINGS) - Published test-name-production (TIMINGS) - http://production.example.com/* - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name-production (TIMINGS) + Deployed test-name-production triggers (TIMINGS) + http://production.example.com/* + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5769,18 +5446,14 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Running custom build: node -e \\"4+4; require('fs').writeFileSync('index.js', 'export default { fetch(){ return new Response(123) } }')\\" - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Running custom build: node -e \\"4+4; require('fs').writeFileSync('index.js', 'export default { fetch(){ return new Response(123) } }')\\" + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5800,18 +5473,14 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Running custom build: echo \\"export default { fetch(){ return new Response(123) } }\\" > index.js - Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Running custom build: echo \\"export default { fetch(){ return new Response(123) } }\\" > index.js + Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -5911,17 +5580,13 @@ addEventListener('fetch', event => {});` mockSubDomainRequest(); await runWrangler("deploy index.js --minify"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -5956,17 +5621,13 @@ addEventListener('fetch', event => {});` mockSubDomainRequest(); await runWrangler("deploy -e testEnv index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (testEnv) (TIMINGS) - Published test-name (testEnv) (TIMINGS) - https://testEnv.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (testEnv) (TIMINGS) + Deployed test-name (testEnv) triggers (TIMINGS) + https://testEnv.test-name.test-sub-domain.workers.dev + Current Version ID: undefined" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); }); @@ -5984,22 +5645,18 @@ addEventListener('fetch', event => {});` ); mockSubDomainRequest(); mockUploadWorkerRequest(); - await runWrangler("deploy index.js"); - expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + await runWrangler("deploy index.js"); + expect(std.out).toMatchInlineSnapshot(` + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -6042,20 +5699,16 @@ addEventListener('fetch', event => {});` mockUploadWorkerRequest(); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass (defined in some-script) - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass (defined in some-script) + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -6087,25 +5740,22 @@ addEventListener('fetch', event => {});` { new_classes: ["SomeOtherClass"] }, ], }, + useOldUploadApi: true, }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - - SOMEOTHERNAME: SomeOtherClass - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + - SOMEOTHERNAME: SomeOtherClass + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -6141,31 +5791,28 @@ addEventListener('fetch', event => {});` }, ], }, + useOldUploadApi: true, }); await runWrangler("deploy index.js"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - - SOMEOTHERNAME: SomeOtherClass - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + - SOMEOTHERNAME: SomeOtherClass + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should not send migrations if they've all already been sent", async () => { @@ -6196,27 +5843,23 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - - SOMEOTHERNAME: SomeOtherClass - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + - SOMEOTHERNAME: SomeOtherClass + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); describe("service environments", () => { @@ -6248,25 +5891,22 @@ addEventListener('fetch', event => {});` { new_classes: ["SomeOtherClass"] }, ], }, + useOldUploadApi: true, }); await runWrangler("deploy index.js --legacy-env false"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - - SOMEOTHERNAME: SomeOtherClass - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + - SOMEOTHERNAME: SomeOtherClass + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -6317,25 +5957,22 @@ addEventListener('fetch', event => {});` { new_classes: ["SomeOtherClass"] }, ], }, + useOldUploadApi: true, }); await runWrangler("deploy index.js --legacy-env false --env xyz"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - - SOMEOTHERNAME: SomeOtherClass - Uploaded test-name (xyz) (TIMINGS) - Published test-name (xyz) (TIMINGS) - https://xyz.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + - SOMEOTHERNAME: SomeOtherClass + Uploaded test-name (xyz) (TIMINGS) + Deployed test-name (xyz) triggers (TIMINGS) + https://xyz.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -6381,36 +6018,33 @@ addEventListener('fetch', event => {});` }, ], }, + useOldUploadApi: true, }); await runWrangler("deploy index.js --legacy-env false"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - - SOMEOTHERNAME: SomeOtherClass - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "▲ [WARNING] Processing wrangler.toml configuration: - - - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in - the future. DO NOT USE IN PRODUCTION. - - ", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + - SOMEOTHERNAME: SomeOtherClass + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "▲ [WARNING] Processing wrangler.toml configuration: + + - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in + the future. DO NOT USE IN PRODUCTION. + + ", + } + `); }); it("should use an environment's current migration tag when publishing migrations", async () => { @@ -6457,36 +6091,33 @@ addEventListener('fetch', event => {});` }, ], }, + useOldUploadApi: true, }); await runWrangler("deploy index.js --legacy-env false --env xyz"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - SOMENAME: SomeClass - - SOMEOTHERNAME: SomeOtherClass - Uploaded test-name (xyz) (TIMINGS) - Published test-name (xyz) (TIMINGS) - https://xyz.test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "▲ [WARNING] Processing wrangler.toml configuration: - - - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in - the future. DO NOT USE IN PRODUCTION. - - ", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - SOMENAME: SomeClass + - SOMEOTHERNAME: SomeOtherClass + Uploaded test-name (xyz) (TIMINGS) + Deployed test-name (xyz) triggers (TIMINGS) + https://xyz.test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "▲ [WARNING] Processing wrangler.toml configuration: + + - Experimental: Service environments are in beta, and their behaviour is guaranteed to change in + the future. DO NOT USE IN PRODUCTION. + + ", + } + `); }); }); }); @@ -6510,17 +6141,13 @@ addEventListener('fetch', event => {});` await runWrangler("publish index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); }); }); @@ -6538,17 +6165,13 @@ addEventListener('fetch', event => {});` await runWrangler("publish index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); }); }); @@ -6761,59 +6384,56 @@ addEventListener('fetch', event => {});` type: "another unsafe thing", }, ], + useOldUploadApi: true, }); mockSubDomainRequest(); mockLegacyScriptData({ scripts: [] }); await expect(runWrangler("deploy index.js")).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Data Blobs: - - DATA_BLOB_ONE: some-data-blob.bin - - DATA_BLOB_TWO: more-data-blob.bin - - Durable Objects: - - DURABLE_OBJECT_ONE: SomeDurableObject (defined in some-durable-object-worker) - - DURABLE_OBJECT_TWO: AnotherDurableObject (defined in another-durable-object-worker) - staging - - KV Namespaces: - - KV_NAMESPACE_ONE: kv-ns-one-id - - KV_NAMESPACE_TWO: kv-ns-two-id - - R2 Buckets: - - R2_BUCKET_ONE: r2-bucket-one-name - - R2_BUCKET_TWO: r2-bucket-two-name - - R2_BUCKET_ONE_EU: r2-bucket-one-name (eu) - - R2_BUCKET_TWO_EU: r2-bucket-two-name (eu) - - logfwdr: - - httplogs: httplogs - - trace: trace - - Analytics Engine Datasets: - - AE_DATASET_ONE: ae-dataset-one-name - - AE_DATASET_TWO: ae-dataset-two-name - - Text Blobs: - - TEXT_BLOB_ONE: my-entire-app-depends-on-this.cfg - - TEXT_BLOB_TWO: the-entirety-of-human-knowledge.txt - - Unsafe: - - some unsafe thing: UNSAFE_BINDING_ONE - - another unsafe thing: UNSAFE_BINDING_TWO - - Vars: - - ENV_VAR_ONE: 123 - - ENV_VAR_TWO: \\"Hello, I'm an environment variable\\" - - Wasm Modules: - - WASM_MODULE_ONE: some_wasm.wasm - - WASM_MODULE_TWO: more_wasm.wasm - - Unsafe Metadata: - - extra_data: \\"interesting value\\" - - more_data: \\"dubious value\\" - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Data Blobs: + - DATA_BLOB_ONE: some-data-blob.bin + - DATA_BLOB_TWO: more-data-blob.bin + - Durable Objects: + - DURABLE_OBJECT_ONE: SomeDurableObject (defined in some-durable-object-worker) + - DURABLE_OBJECT_TWO: AnotherDurableObject (defined in another-durable-object-worker) - staging + - KV Namespaces: + - KV_NAMESPACE_ONE: kv-ns-one-id + - KV_NAMESPACE_TWO: kv-ns-two-id + - R2 Buckets: + - R2_BUCKET_ONE: r2-bucket-one-name + - R2_BUCKET_TWO: r2-bucket-two-name + - R2_BUCKET_ONE_EU: r2-bucket-one-name (eu) + - R2_BUCKET_TWO_EU: r2-bucket-two-name (eu) + - logfwdr: + - httplogs: httplogs + - trace: trace + - Analytics Engine Datasets: + - AE_DATASET_ONE: ae-dataset-one-name + - AE_DATASET_TWO: ae-dataset-two-name + - Text Blobs: + - TEXT_BLOB_ONE: my-entire-app-depends-on-this.cfg + - TEXT_BLOB_TWO: the-entirety-of-human-knowledge.txt + - Unsafe: + - some unsafe thing: UNSAFE_BINDING_ONE + - another unsafe thing: UNSAFE_BINDING_TWO + - Vars: + - ENV_VAR_ONE: 123 + - ENV_VAR_TWO: \\"Hello, I'm an environment variable\\" + - Wasm Modules: + - WASM_MODULE_ONE: some_wasm.wasm + - WASM_MODULE_TWO: more_wasm.wasm + - Unsafe Metadata: + - extra_data: \\"interesting value\\" + - more_data: \\"dubious value\\" + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -7215,25 +6835,22 @@ addEventListener('fetch', event => {});` expectedBindings: [ { name: "TESTWASMNAME", part: "TESTWASMNAME", type: "wasm_module" }, ], + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Wasm Modules: - - TESTWASMNAME: path/to/test.wasm - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Wasm Modules: + - TESTWASMNAME: path/to/test.wasm + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7289,24 +6906,21 @@ addEventListener('fetch', event => {});` { name: "TESTWASMNAME", part: "TESTWASMNAME", type: "wasm_module" }, ], expectedCompatibilityDate: "2022-01-12", + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy index.js --config ./path/to/wrangler.toml"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Wasm Modules: - - TESTWASMNAME: path/to/and/the/path/to/test.wasm - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Wasm Modules: + - TESTWASMNAME: path/to/and/the/path/to/test.wasm + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7331,21 +6945,18 @@ addEventListener('fetch', event => {});` type: "wasm_module", }, ], + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7371,24 +6982,21 @@ addEventListener('fetch', event => {});` type: "text_blob", }, ], + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Text Blobs: - - TESTTEXTBLOBNAME: path/to/text.file - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Text Blobs: + - TESTTEXTBLOBNAME: path/to/text.file + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7448,24 +7056,21 @@ addEventListener('fetch', event => {});` }, ], expectedCompatibilityDate: "2022-01-12", + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy index.js --config ./path/to/wrangler.toml"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Text Blobs: - - TESTTEXTBLOBNAME: path/to/and/the/path/to/text.file - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Text Blobs: + - TESTTEXTBLOBNAME: path/to/and/the/path/to/text.file + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7491,24 +7096,21 @@ addEventListener('fetch', event => {});` type: "data_blob", }, ], + useOldUploadApi: true, }); mockSubDomainRequest(); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Data Blobs: - - TESTDATABLOBNAME: path/to/data.bin - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Data Blobs: + - TESTDATABLOBNAME: path/to/data.bin + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7567,25 +7169,22 @@ addEventListener('fetch', event => {});` type: "data_blob", }, ], - expectedCompatibilityDate: "2022-01-12", - }); - mockSubDomainRequest(); - await runWrangler("deploy index.js --config ./path/to/wrangler.toml"); - expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Data Blobs: - - TESTDATABLOBNAME: path/to/and/the/path/to/data.bin - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + expectedCompatibilityDate: "2022-01-12", + useOldUploadApi: true, + }); + mockSubDomainRequest(); + await runWrangler("deploy index.js --config ./path/to/wrangler.toml"); + expect(std.out).toMatchInlineSnapshot(` + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Data Blobs: + - TESTDATABLOBNAME: path/to/and/the/path/to/data.bin + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7616,25 +7215,21 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Vars: - - text: \\"plain ol' string\\" - - count: 1 - - complex: { - \\"enabled\\": true, - \\"id\\": 123 - } - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Vars: + - text: \\"plain ol' string\\" + - count: 1 + - complex: { + \\"enabled\\": true, + \\"id\\": 123 + } + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7646,27 +7241,23 @@ addEventListener('fetch', event => {});` mockUploadWorkerRequest(); await runWrangler("deploy index.js --var TEXT:sometext --var COUNT:1"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Vars: - - TEXT: \\"(hidden)\\" - - COUNT: \\"(hidden)\\" - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Vars: + - TEXT: \\"(hidden)\\" + - COUNT: \\"(hidden)\\" + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); }); @@ -7685,20 +7276,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - R2 Buckets: - - FOO: foo-bucket - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - R2 Buckets: + - FOO: foo-bucket + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7739,21 +7326,17 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - logfwdr: - - httplogs: httplogs - - trace: trace - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - logfwdr: + - httplogs: httplogs + - trace: trace + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7817,20 +7400,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - EXAMPLE_DO_BINDING: ExampleDurableObject - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - EXAMPLE_DO_BINDING: ExampleDurableObject + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7859,24 +7438,21 @@ addEventListener('fetch', event => {});` type: "durable_object_namespace", }, ], + useOldUploadApi: true, }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - EXAMPLE_DO_BINDING: ExampleDurableObject (defined in example-do-binding-worker) - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - EXAMPLE_DO_BINDING: ExampleDurableObject (defined in example-do-binding-worker) + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -7914,20 +7490,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Durable Objects: - - EXAMPLE_DO_BINDING: ExampleDurableObject - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Durable Objects: + - EXAMPLE_DO_BINDING: ExampleDurableObject + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8041,20 +7613,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Services: - - FOO: foo-service - production - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Services: + - FOO: foo-service - production + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8086,20 +7654,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Services: - - FOO: foo-service - production (#MyHandler) - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Services: + - FOO: foo-service - production (#MyHandler) + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8122,20 +7686,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Analytics Engine Datasets: - - FOO: foo-dataset - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Analytics Engine Datasets: + - FOO: foo-dataset + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8164,20 +7724,16 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - dispatch namespaces: - - foo: Foo - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - dispatch namespaces: + - foo: Foo + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8226,21 +7782,17 @@ addEventListener('fetch', event => {});` }); await runWrangler("publish index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - dispatch namespaces: - - foo: Foo (outbound -> foo_outbound) - - bar: Bar (outbound -> bar_outbound) - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - dispatch namespaces: + - foo: Foo (outbound -> foo_outbound) + - bar: Bar (outbound -> bar_outbound) + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] \`wrangler publish\` is deprecated and will be removed in the next major version. @@ -8287,20 +7839,16 @@ addEventListener('fetch', event => {});` }); await runWrangler("publish index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - dispatch namespaces: - - foo: Foo (outbound -> foo_outbound) - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - dispatch namespaces: + - foo: Foo (outbound -> foo_outbound) + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] \`wrangler publish\` is deprecated and will be removed in the next major version. @@ -8341,22 +7889,18 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Unsafe Metadata: - - stringify: true - - something: \\"else\\" - - nested: {\\"stuff\\":\\"here\\"} - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Unsafe Metadata: + - stringify: true + - something: \\"else\\" + - nested: {\\"stuff\\":\\"here\\"} + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); }); it("should warn if using unsafe bindings", async () => { @@ -8386,20 +7930,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Unsafe: - - binding-type: my-binding - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Unsafe: + - binding-type: my-binding + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -8437,20 +7977,16 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Unsafe: - - plain_text: my-binding - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Unsafe: + - plain_text: my-binding + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -8484,17 +8020,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -8592,17 +8124,13 @@ addEventListener('fetch', event => {});` await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -8637,20 +8165,17 @@ addEventListener('fetch', event => {});` __2d91d1c4dd6e57d4f5432187ab7c25f45a8973f0_text_file: "SOME TEXT CONTENT", }, + useOldUploadApi: true, }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8675,17 +8200,13 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8714,17 +8235,13 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Processing wrangler.toml configuration: @@ -8769,17 +8286,13 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8870,20 +8383,17 @@ addEventListener('fetch', event => {});` expectedModules: { __text_file: "SOME TEXT CONTENT", }, + useOldUploadApi: true, }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8904,21 +8414,17 @@ addEventListener('fetch', event => {});` expectedBindings: [], expectedModules: { "./text.file": "SOME TEXT CONTENT", - }, - }); - await runWrangler("deploy index.js"); - expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + }, + }); + await runWrangler("deploy index.js"); + expect(std.out).toMatchInlineSnapshot(` + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8944,17 +8450,13 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -8980,17 +8482,13 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"text.file\\" with \\"./text.file\\"; @@ -9015,17 +8513,13 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"index.wasm\\" with \\"./index.wasm\\"; @@ -9052,17 +8546,13 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(` "▲ [WARNING] Deprecation: detected a legacy module import in \\"./index.js\\". This will stop working in the future. Replace references to \\"text+name.file\\" with \\"./text+name.file\\"; @@ -9087,17 +8577,13 @@ addEventListener('fetch', event => {});` "deploy index.js --compatibility-date 2022-03-17 --name test-name" ); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); expect(std.warn).toMatchInlineSnapshot(`""`); }); @@ -9131,23 +8617,19 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.ts"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should output to target es2022 even if tsconfig says otherwise", async () => { @@ -9187,23 +8669,19 @@ addEventListener('fetch', event => {});` }); await runWrangler("deploy index.js"); // this would throw if we tried to compile with es5 expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); }); @@ -9217,23 +8695,19 @@ addEventListener('fetch', event => {});` expect(fs.existsSync("some-dir/index.js")).toBe(true); expect(fs.existsSync("some-dir/index.js.map")).toBe(true); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should preserve the entry point file name, even when using a facade", async () => { @@ -9272,13 +8746,9 @@ addEventListener('fetch', event => {});` Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", + Current Version ID: Galaxy-Class", "warn": "▲ [WARNING] The --legacy-assets argument is experimental and may change or break at any time. ", @@ -9328,23 +8798,19 @@ export default{ ) ).toBe(true); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); }); @@ -9567,23 +9033,19 @@ export default{ await runWrangler("deploy"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); it("should print the bundle size, with API errors", async () => { @@ -9591,17 +9053,20 @@ export default{ mockUploadWorkerRequest(); // Override PUT call to error out from previous helper functions msw.use( - http.put("*/accounts/:accountId/workers/scripts/:scriptName", () => { - return HttpResponse.json( - createFetchResult(null, false, [ - { - code: 11337, - message: - "Worker Startup Timed out. This could be due to script exceeding size limits or expensive code in the global scope.", - }, - ]) - ); - }) + http.post( + "*/accounts/:accountId/workers/scripts/:scriptName/versions", + () => { + return HttpResponse.json( + createFetchResult(null, false, [ + { + code: 11337, + message: + "Worker Startup Timed out. This could be due to script exceeding size limits or expensive code in the global scope.", + }, + ]) + ); + } + ) ); fs.writeFileSync( @@ -9630,44 +9095,47 @@ export default{ }); await expect(runWrangler("deploy")).rejects.toMatchInlineSnapshot( - `[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]` + `[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name/versions) failed.]` ); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB - X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed. + X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name/versions) failed. - Worker Startup Timed out. This could be due to script exceeding size limits or expensive code in - the global scope. [code: 11337] + Worker Startup Timed out. This could be due to script exceeding size limits or expensive code in + the global scope. [code: 11337] - If you think this is a bug, please open an issue at: - https://github.com/cloudflare/workers-sdk/issues/new/choose + If you think this is a bug, please open an issue at: + https://github.com/cloudflare/workers-sdk/issues/new/choose - ", - "warn": "", - } - `); + ", + "warn": "", + } + `); }); test("should check biggest dependencies when upload fails with script size error", async () => { mockSubDomainRequest(); mockUploadWorkerRequest(); - // Override PUT call to error out from previous helper functions + // Override POST call to error out from previous helper functions msw.use( - http.put("*/accounts/:accountId/workers/scripts/:scriptName", () => { - return HttpResponse.json( - createFetchResult({}, false, [ - { - code: 10027, - message: "workers.api.error.script_too_large", - }, - ]) - ); - }) + http.post( + "*/accounts/:accountId/workers/scripts/:scriptName/versions", + () => { + return HttpResponse.json( + createFetchResult({}, false, [ + { + code: 10027, + message: "workers.api.error.script_too_large", + }, + ]) + ); + } + ) ); fs.writeFileSync( @@ -9698,52 +9166,55 @@ export default{ }); await expect(runWrangler("deploy")).rejects.toMatchInlineSnapshot( - `[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]` + `[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name/versions) failed.]` ); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB - X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed. + X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name/versions) failed. - workers.api.error.script_too_large [code: 10027] + workers.api.error.script_too_large [code: 10027] - If you think this is a bug, please open an issue at: - https://github.com/cloudflare/workers-sdk/issues/new/choose + If you think this is a bug, please open an issue at: + https://github.com/cloudflare/workers-sdk/issues/new/choose - ", - "warn": "▲ [WARNING] Here are the 4 largest dependencies included in your script: + ", + "warn": "▲ [WARNING] Here are the 4 largest dependencies included in your script: - - index.js - xx KiB - - add.wasm - xx KiB - - dependency.js - xx KiB - - message.txt - xx KiB - If these are unnecessary, consider removing them + - index.js - xx KiB + - add.wasm - xx KiB + - dependency.js - xx KiB + - message.txt - xx KiB + If these are unnecessary, consider removing them - ", - } - `); + ", + } + `); }); test("should offer some helpful advice when upload fails with script startup error", async () => { - mockSubDomainRequest(); - mockUploadWorkerRequest(); - // Override PUT call to error out from previous helper functions - msw.use( - http.put("*/accounts/:accountId/workers/scripts/:scriptName", () => { - return HttpResponse.json( - createFetchResult({}, false, [ - { - code: 10021, - message: "Error: Script startup exceeded CPU time limit.", - }, - ]) - ); - }) + mockSubDomainRequest(); + mockUploadWorkerRequest(); + // Override POST call to error out from previous helper functions + msw.use( + http.post( + "*/accounts/:accountId/workers/scripts/:scriptName/versions", + () => { + return HttpResponse.json( + createFetchResult({}, false, [ + { + code: 10021, + message: "Error: Script startup exceeded CPU time limit.", + }, + ]) + ); + } + ) ); fs.writeFileSync("dependency.js", `export const thing = "a string dep";`); @@ -9763,34 +9234,34 @@ export default{ }); await expect(runWrangler("deploy")).rejects.toMatchInlineSnapshot( - `[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed.]` + `[APIError: A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name/versions) failed.]` ); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB - X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name) failed. + X [ERROR] A request to the Cloudflare API (/accounts/some-account-id/workers/scripts/test-name/versions) failed. - Error: Script startup exceeded CPU time limit. [code: 10021] + Error: Script startup exceeded CPU time limit. [code: 10021] - If you think this is a bug, please open an issue at: - https://github.com/cloudflare/workers-sdk/issues/new/choose + If you think this is a bug, please open an issue at: + https://github.com/cloudflare/workers-sdk/issues/new/choose - ", - "warn": "▲ [WARNING] Your Worker failed validation because it exceeded startup limits. + ", + "warn": "▲ [WARNING] Your Worker failed validation because it exceeded startup limits. - To ensure fast responses, we place constraints on Worker startup -- like how much CPU it can use, - or how long it can take. - Your Worker failed validation, which means it hit one of these startup limits. - Try reducing the amount of work done during startup (outside the event handler), either by - removing code or relocating it inside the event handler. + To ensure fast responses, we place constraints on Worker startup -- like how much CPU it can use, + or how long it can take. + Your Worker failed validation, which means it hit one of these startup limits. + Try reducing the amount of work done during startup (outside the event handler), either by + removing code or relocating it inside the event handler. - ", - } - `); + ", + } + `); }); describe("unit tests", () => { @@ -9998,21 +9469,17 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Queues: - - QUEUE_ONE: queue1 - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Producer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Queues: + - QUEUE_ONE: queue1 + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Producer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should update queue producers on deploy", async () => { @@ -10049,21 +9516,17 @@ export default{ }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Queues: - - MY_QUEUE: queue1 - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Producer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Queues: + - MY_QUEUE: queue1 + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Producer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should post worker queue consumers on deploy", async () => { @@ -10108,18 +9571,14 @@ export default{ }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should post worker queue consumers on deploy, using command line script name arg", async () => { @@ -10168,14 +9627,10 @@ export default{ "Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded command-line-arg-script-name (TIMINGS) - Published command-line-arg-script-name (TIMINGS) + Deployed command-line-arg-script-name triggers (TIMINGS) https://command-line-arg-script-name.test-sub-domain.workers.dev Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + Current Version ID: Galaxy-Class" `); }); @@ -10229,18 +9684,14 @@ export default{ }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should update worker (service) queue consumers with default environment on deploy", async () => { @@ -10298,18 +9749,14 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should post queue http consumers on deploy", async () => { @@ -10354,18 +9801,14 @@ export default{ }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should update queue http consumers when one already exists for queue", async () => { @@ -10418,18 +9861,14 @@ export default{ ); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should support queue consumer concurrency with a max concurrency specified", async () => { @@ -10482,18 +9921,14 @@ export default{ }); await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should support queue consumer concurrency with a null max concurrency", async () => { @@ -10547,18 +9982,14 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("should support queue consumer with max_batch_timeout of 0", async () => { @@ -10612,18 +10043,14 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Consumer for queue1 - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Consumer for queue1 + Current Version ID: Galaxy-Class" + `); }); it("consumer should error when a queue doesn't exist", async () => { @@ -10831,22 +10258,18 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Browser: - - Name: MYBROWSER - - AI: - - Name: AI_BIND - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Browser: + - Name: MYBROWSER + - AI: + - Name: AI_BIND + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); }); }); @@ -10882,13 +10305,9 @@ export default{ Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + Current Version ID: Galaxy-Class" `); }); @@ -10922,13 +10341,9 @@ export default{ Total Upload: xx KiB / gzip: xx KiB Worker Startup Time: 100 ms Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" + Current Version ID: Galaxy-Class" `); }); }); @@ -10957,20 +10372,16 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - Hyperdrive Configs: - - HYPERDRIVE: 343cd4f1d58c42fbb5bd082592fd7143 - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - Hyperdrive Configs: + - HYPERDRIVE: 343cd4f1d58c42fbb5bd082592fd7143 + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); }); }); @@ -10993,20 +10404,16 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Your worker has access to the following bindings: - - mTLS Certificates: - - CERT_ONE: 1234 - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Your worker has access to the following bindings: + - mTLS Certificates: + - CERT_ONE: 1234 + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); }); }); @@ -11025,17 +10432,13 @@ export default{ await runWrangler("deploy index.js --keep-vars"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -11053,17 +10456,13 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -11083,17 +10482,13 @@ export default{ await runWrangler("deploy index.js"); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class" + `); expect(std.err).toMatchInlineSnapshot(`""`); }); }); @@ -11118,16 +10513,12 @@ export default{ "deploy --dispatch-namespace test-dispatch-namespace index.js" ); expect(std.out).toMatchInlineSnapshot(` - "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Dispatch Namespace: test-dispatch-namespace - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Dispatch Namespace: test-dispatch-namespace + Current Version ID: undefined" + `); }); }); }); diff --git a/packages/wrangler/src/__tests__/deployments.test.ts b/packages/wrangler/src/__tests__/deployments.test.ts index c32a26cb63d8..b2eac88e1290 100644 --- a/packages/wrangler/src/__tests__/deployments.test.ts +++ b/packages/wrangler/src/__tests__/deployments.test.ts @@ -23,6 +23,8 @@ function isFileNotFound(e: unknown) { ); } +// This is testing the old deployments behaviour, which is now deprecated +// and replaced by the versions one - see the new tests in versions/deployments/... describe("deployments", () => { const std = mockConsoleMethods(); runInTempDir(); @@ -57,23 +59,18 @@ describe("deployments", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler deployments - 🚢 List and view the current and past deployments for your Worker [open beta] + 🚢 List and view the current and past deployments for your Worker COMMANDS - wrangler deployments list Displays the 10 most recent deployments for a Worker - wrangler deployments view [deployment-id] View a deployment + wrangler deployments list Displays the 10 most recent deployments of your Worker + wrangler deployments status View the current state of your production GLOBAL FLAGS -j, --experimental-json-config Experimental: support wrangler.json [boolean] -c, --config Path to .toml configuration file [string] -e, --env Environment to use for operations and .env files [string] -h, --help Show help [boolean] - -v, --version Show version number [boolean] - - OPTIONS - --name The name of your Worker [string] - - 🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose" + -v, --version Show version number [boolean]" `); }); @@ -82,173 +79,151 @@ describe("deployments", () => { it("should log deployments", async () => { writeWranglerToml(); - await runWrangler("deployments list"); + await runWrangler("deployments list --no-x-versions"); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Deployment ID: Constitution-Class-tag:test-name - Version ID: Constitution-Class-tag:test-name - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload from Wrangler 🤠 - - Deployment ID: Intrepid-Class-tag:test-name - Version ID: Intrepid-Class-tag:test-name - Created on: 2021-02-02T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-1111 - Message: Rolled back for this version - - Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Version ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Created on: 2021-02-03T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - - Deployment ID: Galaxy-Class-tag:test-name - Version ID: Galaxy-Class-tag:test-name - Created on: 2021-01-04T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-2222 - 🟩 Active - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Version ID: Constitution-Class-tag:test-name + Created on: 2021-01-01T00:00:00.000000Z + Author: Jean-Luc-Picard@federation.org + Source: Upload from Wrangler 🤠 + + Version ID: Intrepid-Class-tag:test-name + Created on: 2021-02-02T00:00:00.000000Z + Author: Kathryn-Janeway@federation.org + Source: Rollback from Wrangler 🤠 + Rollback from: MOCK-DEPLOYMENT-ID-1111 + Message: Rolled back for this version + + Version ID: 3mEgaU1T-Intrepid-someThing-tag:test-name + Created on: 2021-02-03T00:00:00.000000Z + Author: Kathryn-Janeway@federation.org + Source: Wrangler 🤠 + + Version ID: Galaxy-Class-tag:test-name + Created on: 2021-01-04T00:00:00.000000Z + Author: Jean-Luc-Picard@federation.org + Source: Rollback from Wrangler 🤠 + Rollback from: MOCK-DEPLOYMENT-ID-2222 + 🟩 Active" + `); }); it("should log deployments for script with passed in name option", async () => { - await runWrangler("deployments list --name something-else"); + await runWrangler( + "deployments list --name something-else --no-x-versions" + ); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Deployment ID: Constitution-Class-tag:something-else - Version ID: Constitution-Class-tag:something-else - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload from Wrangler 🤠 - - Deployment ID: Intrepid-Class-tag:something-else - Version ID: Intrepid-Class-tag:something-else - Created on: 2021-02-02T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-1111 - Message: Rolled back for this version - - Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:something-else - Version ID: 3mEgaU1T-Intrepid-someThing-tag:something-else - Created on: 2021-02-03T00:00:00.000000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - - Deployment ID: Galaxy-Class-tag:something-else - Version ID: Galaxy-Class-tag:something-else - Created on: 2021-01-04T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback from Wrangler 🤠 - Rollback from: MOCK-DEPLOYMENT-ID-2222 - 🟩 Active - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Version ID: Constitution-Class-tag:something-else + Created on: 2021-01-01T00:00:00.000000Z + Author: Jean-Luc-Picard@federation.org + Source: Upload from Wrangler 🤠 + + Version ID: Intrepid-Class-tag:something-else + Created on: 2021-02-02T00:00:00.000000Z + Author: Kathryn-Janeway@federation.org + Source: Rollback from Wrangler 🤠 + Rollback from: MOCK-DEPLOYMENT-ID-1111 + Message: Rolled back for this version + + Version ID: 3mEgaU1T-Intrepid-someThing-tag:something-else + Created on: 2021-02-03T00:00:00.000000Z + Author: Kathryn-Janeway@federation.org + Source: Wrangler 🤠 + + Version ID: Galaxy-Class-tag:something-else + Created on: 2021-01-04T00:00:00.000000Z + Author: Jean-Luc-Picard@federation.org + Source: Rollback from Wrangler 🤠 + Rollback from: MOCK-DEPLOYMENT-ID-2222 + 🟩 Active" + `); }); it("should error on missing script name", async () => { await expect( - runWrangler("deployments list") + runWrangler("deployments list --no-x-versions") ).rejects.toMatchInlineSnapshot( `[Error: Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with \`--name\`]` ); }); }); + describe("deployment view", () => { - it("should log deployment details", async () => { + it("should error with no --no-x-versions flag", async () => { writeWranglerToml(); - await runWrangler("deployments view 1701-E"); - - expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Deployment ID: 1701-E - Version ID: 1701-E - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Wrangler 🤠 - ------------------------------------------------------------ - Author ID: Picard-Gamma-6-0-7-3 - Usage Model: bundled - Handlers: fetch - --------------------------bindings-------------------------- - None + await expect( + runWrangler("deployments view 1701-E") + ).rejects.toThrowErrorMatchingInlineSnapshot( + `[Error: \`wrangler deployments view \` has been renamed \`wrangler versions view [version-id] --x-versions\`. Please use that command instead.]` + ); + }); + it("should log deployment details", async () => { + writeWranglerToml(); + await runWrangler("deployments view 1701-E --no-x-versions"); - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + expect(std.out).toMatchInlineSnapshot(` + " + Version ID: 1701-E + Created on: 2021-01-01T00:00:00.000000Z + Author: Jean-Luc-Picard@federation.org + Source: Wrangler 🤠 + ------------------------------------------------------------ + Author ID: Picard-Gamma-6-0-7-3 + Usage Model: bundled + Handlers: fetch + --------------------------bindings-------------------------- + None + " + `); }); it("should log deployment details with bindings", async () => { writeWranglerToml(); - await runWrangler("deployments view bindings-tag"); + await runWrangler("deployments view bindings-tag --no-x-versions"); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Deployment ID: 1701-E - Version ID: 1701-E - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Wrangler 🤠 - ------------------------------------------------------------ - Author ID: Picard-Gamma-6-0-7-3 - Usage Model: bundled - Handlers: fetch - --------------------------bindings-------------------------- - [[r2_buckets]] - binding = \\"MY_BUCKET\\" - bucket_name = \\"testr2\\" - - - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Version ID: 1701-E + Created on: 2021-01-01T00:00:00.000000Z + Author: Jean-Luc-Picard@federation.org + Source: Wrangler 🤠 + ------------------------------------------------------------ + Author ID: Picard-Gamma-6-0-7-3 + Usage Model: bundled + Handlers: fetch + --------------------------bindings-------------------------- + [[r2_buckets]] + binding = \\"MY_BUCKET\\" + bucket_name = \\"testr2\\" + + " + `); }); + it("should automatically log latest deployment details", async () => { writeWranglerToml(); - await runWrangler("deployments view"); + await runWrangler("deployments view --no-x-versions"); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler deployments\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Deployment ID: 1701-E - Version ID: 1701-E - Created on: 2021-01-01T00:00:00.000000Z - Author: Jean-Luc-Picard@federation.org - Source: Wrangler 🤠 - ------------------------------------------------------------ - Author ID: Picard-Gamma-6-0-7-3 - Usage Model: bundled - Handlers: fetch - --------------------------bindings-------------------------- - None - - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Version ID: 1701-E + Created on: 2021-01-01T00:00:00.000000Z + Author: Jean-Luc-Picard@federation.org + Source: Wrangler 🤠 + ------------------------------------------------------------ + Author ID: Picard-Gamma-6-0-7-3 + Usage Model: bundled + Handlers: fetch + --------------------------bindings-------------------------- + None + " + `); }); }); @@ -310,18 +285,14 @@ describe("deployments", () => { }); writeWranglerToml(); - await runWrangler("rollback 3mEgaU1T-Intrepid-someThing-tag:test-name"); + await runWrangler( + "rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --no-x-versions" + ); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler rollback\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Deployment ID: galactic_mission_alpha - Current Version ID: galactic_mission_alpha - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name + Current Version ID: galactic_mission_alpha" + `); expect(requests.count).toEqual(1); }); @@ -333,11 +304,10 @@ describe("deployments", () => { }); writeWranglerToml(); - await runWrangler("rollback 3mEgaU1T-Intrpid-someThing-tag:test-name"); - expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler rollback\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - " - `); + await runWrangler( + "rollback 3mEgaU1T-Intrpid-someThing-tag:test-name --no-x-versions" + ); + expect(std.out).toMatchInlineSnapshot(`""`); expect(requests.count).toEqual(0); }); @@ -346,22 +316,18 @@ describe("deployments", () => { setIsTTY(false); writeWranglerToml(); - await runWrangler("rollback 3mEgaU1T-Intrepid-someThing-tag:test-name"); + await runWrangler( + "rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --no-x-versions" + ); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler rollback\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - ? This deployment 3mEgaU1T will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. Note: Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc). - 🤖 Using fallback value in non-interactive context: yes - ? Please provide a message for this rollback (120 characters max) - 🤖 Using default value in non-interactive context: - - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Deployment ID: galactic_mission_alpha - Current Version ID: galactic_mission_alpha + "? This deployment 3mEgaU1T will immediately replace the current deployment and become the active deployment across all your deployed routes and domains. However, your local development environment will not be affected by this rollback. Note: Rolling back to a previous deployment will not rollback any of the bound resources (Durable Object, D1, R2, KV, etc). + 🤖 Using fallback value in non-interactive context: yes + ? Please provide a message for this rollback (120 characters max) + 🤖 Using default value in non-interactive context: - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name + Current Version ID: galactic_mission_alpha" + `); expect(requests.count).toEqual(1); }); @@ -369,19 +335,13 @@ describe("deployments", () => { it("should skip prompt automatically in rollback if message flag is provided", async () => { writeWranglerToml(); await runWrangler( - `rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --message "test"` + `rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --message "test" --no-x-versions` ); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler rollback\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Deployment ID: galactic_mission_alpha - Current Version ID: galactic_mission_alpha - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name + Current Version ID: galactic_mission_alpha" + `); expect(requests.count).toEqual(1); }); @@ -389,19 +349,13 @@ describe("deployments", () => { it("should skip prompt automatically in rollback with empty message", async () => { writeWranglerToml(); await runWrangler( - `rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --message "test"` + `rollback 3mEgaU1T-Intrepid-someThing-tag:test-name --message "test" --no-x-versions` ); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler rollback\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Deployment ID: galactic_mission_alpha - Current Version ID: galactic_mission_alpha - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name + Current Version ID: galactic_mission_alpha" + `); expect(requests.count).toEqual(1); }); @@ -418,25 +372,19 @@ describe("deployments", () => { }); writeWranglerToml(); - await runWrangler("rollback"); + await runWrangler("rollback --no-x-versions"); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler rollback\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name - Current Deployment ID: galactic_mission_alpha - Current Version ID: galactic_mission_alpha - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:test-name + Current Version ID: galactic_mission_alpha" + `); expect(requests.count).toEqual(1); }); it("should require a worker name", async () => { await expect(runWrangler("rollback")).rejects.toMatchInlineSnapshot( - `[Error: Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with \`--name\`]` + `[Error: You need to provide a name of your worker. Either pass it as a cli arg with \`--name \` or in your config file as \`name = ""\`]` ); expect(requests.count).toEqual(0); @@ -453,18 +401,12 @@ describe("deployments", () => { result: "", }); - await runWrangler("rollback --name something-else"); + await runWrangler("rollback --name something-else --no-x-versions"); expect(std.out).toMatchInlineSnapshot(` - "🚧\`wrangler rollback\` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose - - - Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:something-else - Current Deployment ID: galactic_mission_alpha - Current Version ID: galactic_mission_alpha - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments" - `); + " + Successfully rolled back to Deployment ID: 3mEgaU1T-Intrepid-someThing-tag:something-else + Current Version ID: galactic_mission_alpha" + `); expect(requests.count).toEqual(1); }); diff --git a/packages/wrangler/src/__tests__/deprecated-usage-model.test.ts b/packages/wrangler/src/__tests__/deprecated-usage-model.test.ts index b302b23e81e7..118bfe4e6408 100644 --- a/packages/wrangler/src/__tests__/deprecated-usage-model.test.ts +++ b/packages/wrangler/src/__tests__/deprecated-usage-model.test.ts @@ -57,22 +57,18 @@ describe("deprecated-usage-model", () => { await runWrangler("deploy ./index"); expect(std).toMatchInlineSnapshot(` - Object { - "debug": "", - "err": "", - "info": "", - "out": "Total Upload: xx KiB / gzip: xx KiB - Worker Startup Time: 100 ms - Uploaded test-name (TIMINGS) - Published test-name (TIMINGS) - https://test-name.test-sub-domain.workers.dev - Current Deployment ID: Galaxy-Class - Current Version ID: Galaxy-Class - - - Note: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: https://developers.cloudflare.com/workers/configuration/versions-and-deployments", - "warn": "", - } - `); + Object { + "debug": "", + "err": "", + "info": "", + "out": "Total Upload: xx KiB / gzip: xx KiB + Worker Startup Time: 100 ms + Uploaded test-name (TIMINGS) + Deployed test-name triggers (TIMINGS) + https://test-name.test-sub-domain.workers.dev + Current Version ID: Galaxy-Class", + "warn": "", + } + `); }); }); diff --git a/packages/wrangler/src/__tests__/helpers/mock-upload-worker.ts b/packages/wrangler/src/__tests__/helpers/mock-upload-worker.ts index fde10b03bda3..b1a2f522ae93 100644 --- a/packages/wrangler/src/__tests__/helpers/mock-upload-worker.ts +++ b/packages/wrangler/src/__tests__/helpers/mock-upload-worker.ts @@ -29,6 +29,7 @@ export function mockUploadWorkerRequest( expectedDispatchNamespace?: string; expectedScriptName?: string; expectedExperimentalAssets?: boolean; + useOldUploadApi?: boolean; } = {} ) { const expectedScriptName = (options.expectedScriptName ??= "test-name"); @@ -41,10 +42,12 @@ export function mockUploadWorkerRequest( if (!legacyEnv) { expect(params.envName).toEqual(env); } - expect(url.searchParams.get("include_subdomain_availability")).toEqual( - "true" - ); - expect(url.searchParams.get("excludeScript")).toEqual("true"); + if (useOldUploadApi) { + expect(url.searchParams.get("include_subdomain_availability")).toEqual( + "true" + ); + expect(url.searchParams.get("excludeScript")).toEqual("true"); + } if (expectedDispatchNamespace) { expect(params.dispatchNamespace).toEqual(expectedDispatchNamespace); } @@ -114,16 +117,30 @@ export function mockUploadWorkerRequest( expect(await serialize(formBody.get(name))).toEqual(content); } + if (useOldUploadApi) { + return HttpResponse.json( + createFetchResult({ + available_on_subdomain, + id: "abc12345", + etag: "etag98765", + pipeline_hash: "hash9999", + mutable_pipeline_id: "mutableId", + tag: "sample-tag", + deployment_id: "Galaxy-Class", + startup_time_ms: 100, + }) + ); + } + return HttpResponse.json( createFetchResult({ - available_on_subdomain, - id: "abc12345", - etag: "etag98765", - pipeline_hash: "hash9999", - mutable_pipeline_id: "mutableId", - tag: "sample-tag", - deployment_id: "Galaxy-Class", + id: "Galaxy-Class", startup_time_ms: 100, + resources: { + script: { + etag: "etag98765", + }, + }, }) ); }; @@ -147,6 +164,7 @@ export function mockUploadWorkerRequest( keepVars, keepSecrets, expectedDispatchNamespace, + useOldUploadApi, } = options; if (env && !legacyEnv) { msw.use( @@ -162,13 +180,24 @@ export function mockUploadWorkerRequest( handleUpload ) ); - } else { + } else if (useOldUploadApi) { msw.use( http.put( "*/accounts/:accountId/workers/scripts/:scriptName", handleUpload ) ); + } else { + msw.use( + http.post( + "*/accounts/:accountId/workers/scripts/:scriptName/versions", + handleUpload + ), + http.post( + "*/accounts/:accountId/workers/scripts/:scriptName/deployments", + () => HttpResponse.json(createFetchResult({ id: "Deployment-ID" })) + ) + ); } msw.use( diff --git a/packages/wrangler/src/__tests__/helpers/msw/handlers/versions.ts b/packages/wrangler/src/__tests__/helpers/msw/handlers/versions.ts index afcd2a78d459..5193caf5c2f2 100644 --- a/packages/wrangler/src/__tests__/helpers/msw/handlers/versions.ts +++ b/packages/wrangler/src/__tests__/helpers/msw/handlers/versions.ts @@ -192,7 +192,7 @@ export const mswListNewDeployments = http.get( ); const latestVersion = (workerName: string) => ({ - id: `10000000-0000-0000-0000-000000000000`, + id: `20000000-0000-0000-0000-000000000000`, number: "1701-E", annotations: { "workers/triggered_by": "rollback", @@ -219,7 +219,7 @@ export const mswListVersions = http.get( latest: latestVersion(workerName), items: [ { - id: `40000000-0000-0000-0000-000000000000`, + id: `10000000-0000-0000-0000-000000000000`, number: "1701-E", annotations: { "workers/triggered_by": "upload", @@ -232,6 +232,7 @@ export const mswListVersions = http.get( modified_on: "2021-01-01T00:00:00.000000Z", }, }, + // Latest version deployed at 01-04 takes 2xxxxxx { id: `30000000-0000-0000-0000-000000000000`, number: "NCC-74656", @@ -249,7 +250,7 @@ export const mswListVersions = http.get( }, }, { - id: `20000000-0000-0000-0000-000000000000`, + id: `40000000-0000-0000-0000-000000000000`, number: "NCC-74656", metadata: { author_id: "Kathryn-Jane-Gamma-6-0-7-3", diff --git a/packages/wrangler/src/__tests__/index.test.ts b/packages/wrangler/src/__tests__/index.test.ts index e3d2f2735ee0..38205dea3235 100644 --- a/packages/wrangler/src/__tests__/index.test.ts +++ b/packages/wrangler/src/__tests__/index.test.ts @@ -36,33 +36,35 @@ describe("wrangler", () => { "wrangler COMMANDS - wrangler docs [command] 📚 Open Wrangler's command documentation in your browser - - wrangler init [name] 📥 Initialize a basic Worker - wrangler dev [script] 👂 Start a local server for developing your Worker - wrangler deploy [script] 🆙 Deploy a Worker to Cloudflare [aliases: publish] - wrangler deployments 🚢 List and view the current and past deployments for your Worker [open beta] - wrangler rollback [deployment-id] 🔙 Rollback a deployment for a Worker [open beta] - wrangler delete [script] 🗑 Delete a Worker from Cloudflare - wrangler tail [worker] 🦚 Start a log tailing session for a Worker - wrangler secret 🤫 Generate a secret that can be referenced in a Worker - wrangler types [path] 📝 Generate types from bindings and module rules in configuration - - wrangler kv 🗂️ Manage Workers KV Namespaces - wrangler queues 🇶 Manage Workers Queues - wrangler r2 📦 Manage R2 buckets & objects - wrangler d1 🗄 Manage Workers D1 databases - wrangler vectorize 🧮 Manage Vectorize indexes [open beta] - wrangler hyperdrive 🚀 Manage Hyperdrive databases - wrangler pages ⚡️ Configure Cloudflare Pages - wrangler mtls-certificate 🪪 Manage certificates used for mTLS connections - wrangler pubsub 📮 Manage Pub/Sub brokers [private beta] - wrangler dispatch-namespace 🏗️ Manage dispatch namespaces - wrangler ai 🤖 Manage AI models - - wrangler login 🔓 Login to Cloudflare - wrangler logout 🚪 Logout from Cloudflare - wrangler whoami 🕵️ Retrieve your user information + wrangler docs [command] 📚 Open Wrangler's command documentation in your browser + + wrangler init [name] 📥 Initialize a basic Worker + wrangler dev [script] 👂 Start a local server for developing your Worker + wrangler deploy [script] 🆙 Deploy a Worker to Cloudflare [aliases: publish] + wrangler deployments 🚢 List and view the current and past deployments for your Worker + wrangler rollback [version-id] 🔙 Rollback a deployment for a Worker + wrangler versions 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare + wrangler triggers 🎯 Updates the triggers of your current deployment + wrangler delete [script] 🗑 Delete a Worker from Cloudflare + wrangler tail [worker] 🦚 Start a log tailing session for a Worker + wrangler secret 🤫 Generate a secret that can be referenced in a Worker + wrangler types [path] 📝 Generate types from bindings and module rules in configuration + + wrangler kv 🗂️ Manage Workers KV Namespaces + wrangler queues 🇶 Manage Workers Queues + wrangler r2 📦 Manage R2 buckets & objects + wrangler d1 🗄 Manage Workers D1 databases + wrangler vectorize 🧮 Manage Vectorize indexes [open beta] + wrangler hyperdrive 🚀 Manage Hyperdrive databases + wrangler pages ⚡️ Configure Cloudflare Pages + wrangler mtls-certificate 🪪 Manage certificates used for mTLS connections + wrangler pubsub 📮 Manage Pub/Sub brokers [private beta] + wrangler dispatch-namespace 🏗️ Manage dispatch namespaces + wrangler ai 🤖 Manage AI models + + wrangler login 🔓 Login to Cloudflare + wrangler logout 🚪 Logout from Cloudflare + wrangler whoami 🕵️ Retrieve your user information GLOBAL FLAGS -j, --experimental-json-config Experimental: support wrangler.json [boolean] @@ -91,33 +93,35 @@ describe("wrangler", () => { wrangler COMMANDS - wrangler docs [command] 📚 Open Wrangler's command documentation in your browser - - wrangler init [name] 📥 Initialize a basic Worker - wrangler dev [script] 👂 Start a local server for developing your Worker - wrangler deploy [script] 🆙 Deploy a Worker to Cloudflare [aliases: publish] - wrangler deployments 🚢 List and view the current and past deployments for your Worker [open beta] - wrangler rollback [deployment-id] 🔙 Rollback a deployment for a Worker [open beta] - wrangler delete [script] 🗑 Delete a Worker from Cloudflare - wrangler tail [worker] 🦚 Start a log tailing session for a Worker - wrangler secret 🤫 Generate a secret that can be referenced in a Worker - wrangler types [path] 📝 Generate types from bindings and module rules in configuration - - wrangler kv 🗂️ Manage Workers KV Namespaces - wrangler queues 🇶 Manage Workers Queues - wrangler r2 📦 Manage R2 buckets & objects - wrangler d1 🗄 Manage Workers D1 databases - wrangler vectorize 🧮 Manage Vectorize indexes [open beta] - wrangler hyperdrive 🚀 Manage Hyperdrive databases - wrangler pages ⚡️ Configure Cloudflare Pages - wrangler mtls-certificate 🪪 Manage certificates used for mTLS connections - wrangler pubsub 📮 Manage Pub/Sub brokers [private beta] - wrangler dispatch-namespace 🏗️ Manage dispatch namespaces - wrangler ai 🤖 Manage AI models - - wrangler login 🔓 Login to Cloudflare - wrangler logout 🚪 Logout from Cloudflare - wrangler whoami 🕵️ Retrieve your user information + wrangler docs [command] 📚 Open Wrangler's command documentation in your browser + + wrangler init [name] 📥 Initialize a basic Worker + wrangler dev [script] 👂 Start a local server for developing your Worker + wrangler deploy [script] 🆙 Deploy a Worker to Cloudflare [aliases: publish] + wrangler deployments 🚢 List and view the current and past deployments for your Worker + wrangler rollback [version-id] 🔙 Rollback a deployment for a Worker + wrangler versions 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare + wrangler triggers 🎯 Updates the triggers of your current deployment + wrangler delete [script] 🗑 Delete a Worker from Cloudflare + wrangler tail [worker] 🦚 Start a log tailing session for a Worker + wrangler secret 🤫 Generate a secret that can be referenced in a Worker + wrangler types [path] 📝 Generate types from bindings and module rules in configuration + + wrangler kv 🗂️ Manage Workers KV Namespaces + wrangler queues 🇶 Manage Workers Queues + wrangler r2 📦 Manage R2 buckets & objects + wrangler d1 🗄 Manage Workers D1 databases + wrangler vectorize 🧮 Manage Vectorize indexes [open beta] + wrangler hyperdrive 🚀 Manage Hyperdrive databases + wrangler pages ⚡️ Configure Cloudflare Pages + wrangler mtls-certificate 🪪 Manage certificates used for mTLS connections + wrangler pubsub 📮 Manage Pub/Sub brokers [private beta] + wrangler dispatch-namespace 🏗️ Manage dispatch namespaces + wrangler ai 🤖 Manage AI models + + wrangler login 🔓 Login to Cloudflare + wrangler logout 🚪 Logout from Cloudflare + wrangler whoami 🕵️ Retrieve your user information GLOBAL FLAGS -j, --experimental-json-config Experimental: support wrangler.json [boolean] diff --git a/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts b/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts index 9cbace8c088c..00251af444b2 100644 --- a/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts +++ b/packages/wrangler/src/__tests__/versions/deployments/deployments.list.test.ts @@ -39,63 +39,63 @@ describe("deployments list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "Created: 2021-01-04T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback - Message: - - Version(s): (10%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (90%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - Created: 2021-01-01T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload - Message: - - Version(s): (20%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (80%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - Created: 2021-02-02T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback - Message: Rolled back for this version - Version(s): (30%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (70%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - Created: 2021-02-03T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - Message: - - Version(s): (40%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (60%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - " - `); + "Created: 2021-01-01T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Upload + Message: - + Version(s): (20%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (80%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + Created: 2021-01-04T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Rollback + Message: - + Version(s): (10%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (90%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + Created: 2021-02-02T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Rollback + Message: Rolled back for this version + Version(s): (30%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (70%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + Created: 2021-02-03T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Wrangler 🤠 + Message: - + Version(s): (40%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (60%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + " + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -108,90 +108,90 @@ describe("deployments list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "[ - { - \\"id\\": \\"Galaxy-Class-test-name\\", - \\"source\\": \\"api\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" - }, - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 10 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 90 - } - ] - }, - { - \\"id\\": \\"Galaxy-Class-test-name\\", - \\"source\\": \\"wrangler\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"upload\\" - }, - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 20 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 80 - } - ] - }, - { - \\"id\\": \\"Intrepid-Class-test-name\\", - \\"source\\": \\"wrangler\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", - \\"workers/message\\": \\"Rolled back for this version\\" - }, - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 30 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 70 - } - ] - }, - { - \\"id\\": \\"3mEgaU1T-Intrepid-someThing-test-name\\", - \\"source\\": \\"wrangler\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 40 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 60 - } - ] - } - ] - " - `); + "[ + { + \\"id\\": \\"Galaxy-Class-test-name\\", + \\"source\\": \\"wrangler\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"upload\\" + }, + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 20 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 80 + } + ] + }, + { + \\"id\\": \\"Galaxy-Class-test-name\\", + \\"source\\": \\"api\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" + }, + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 10 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 90 + } + ] + }, + { + \\"id\\": \\"Intrepid-Class-test-name\\", + \\"source\\": \\"wrangler\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", + \\"workers/message\\": \\"Rolled back for this version\\" + }, + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 30 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 70 + } + ] + }, + { + \\"id\\": \\"3mEgaU1T-Intrepid-someThing-test-name\\", + \\"source\\": \\"wrangler\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 40 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 60 + } + ] + } + ] + " + `); }); }); @@ -204,63 +204,63 @@ describe("deployments list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "Created: 2021-01-04T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback - Message: - - Version(s): (10%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (90%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - Created: 2021-01-01T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload - Message: - - Version(s): (20%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (80%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - Created: 2021-02-02T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback - Message: Rolled back for this version - Version(s): (30%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (70%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - Created: 2021-02-03T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - Message: - - Version(s): (40%) 10000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - - (60%) 20000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Tag: - - Message: - - " - `); + "Created: 2021-01-01T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Upload + Message: - + Version(s): (20%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (80%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + Created: 2021-01-04T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Rollback + Message: - + Version(s): (10%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (90%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + Created: 2021-02-02T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Rollback + Message: Rolled back for this version + Version(s): (30%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (70%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + Created: 2021-02-03T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Wrangler 🤠 + Message: - + Version(s): (40%) 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + + (60%) 20000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Tag: - + Message: - + " + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -273,90 +273,90 @@ describe("deployments list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "[ - { - \\"id\\": \\"Galaxy-Class-test-name\\", - \\"source\\": \\"api\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" - }, - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 10 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 90 - } - ] - }, - { - \\"id\\": \\"Galaxy-Class-test-name\\", - \\"source\\": \\"wrangler\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"upload\\" - }, - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 20 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 80 - } - ] - }, - { - \\"id\\": \\"Intrepid-Class-test-name\\", - \\"source\\": \\"wrangler\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", - \\"workers/message\\": \\"Rolled back for this version\\" - }, - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 30 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 70 - } - ] - }, - { - \\"id\\": \\"3mEgaU1T-Intrepid-someThing-test-name\\", - \\"source\\": \\"wrangler\\", - \\"strategy\\": \\"percentage\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", - \\"versions\\": [ - { - \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 40 - }, - { - \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"percentage\\": 60 - } - ] - } - ] - " - `); + "[ + { + \\"id\\": \\"Galaxy-Class-test-name\\", + \\"source\\": \\"wrangler\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"upload\\" + }, + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 20 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 80 + } + ] + }, + { + \\"id\\": \\"Galaxy-Class-test-name\\", + \\"source\\": \\"api\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" + }, + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 10 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 90 + } + ] + }, + { + \\"id\\": \\"Intrepid-Class-test-name\\", + \\"source\\": \\"wrangler\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", + \\"workers/message\\": \\"Rolled back for this version\\" + }, + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 30 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 70 + } + ] + }, + { + \\"id\\": \\"3mEgaU1T-Intrepid-someThing-test-name\\", + \\"source\\": \\"wrangler\\", + \\"strategy\\": \\"percentage\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", + \\"versions\\": [ + { + \\"version_id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 40 + }, + { + \\"version_id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"percentage\\": 60 + } + ] + } + ] + " + `); }); }); }); diff --git a/packages/wrangler/src/__tests__/versions/versions.help.test.ts b/packages/wrangler/src/__tests__/versions/versions.help.test.ts index c0d464e427c5..836a7c9c16e3 100644 --- a/packages/wrangler/src/__tests__/versions/versions.help.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.help.test.ts @@ -5,8 +5,8 @@ import { runWrangler } from "../helpers/run-wrangler"; describe("versions --help", () => { const std = mockConsoleMethods(); - test("shows generic help w/ --help flag but w/o --experimental-versions flag", async () => { - const result = runWrangler("versions --help"); + test("shows generic help w/ --help flag and --no-experimental-versions flag", async () => { + const result = runWrangler("versions --help --no-experimental-versions"); await expect(result).resolves.toBeUndefined(); @@ -19,8 +19,8 @@ describe("versions --help", () => { wrangler init [name] 📥 Initialize a basic Worker wrangler dev [script] 👂 Start a local server for developing your Worker wrangler deploy [script] 🆙 Deploy a Worker to Cloudflare [aliases: publish] - wrangler deployments 🚢 List and view the current and past deployments for your Worker [open beta] - wrangler rollback [deployment-id] 🔙 Rollback a deployment for a Worker [open beta] + wrangler deployments 🚢 List and view the current and past deployments for your Worker + wrangler rollback [deployment-id] 🔙 Rollback a deployment for a Worker wrangler delete [script] 🗑 Delete a Worker from Cloudflare wrangler tail [worker] 🦚 Start a log tailing session for a Worker wrangler secret 🤫 Generate a secret that can be referenced in a Worker @@ -61,7 +61,7 @@ describe("versions --help", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler versions - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare COMMANDS wrangler versions view View the details of a specific version of your Worker [beta] @@ -78,21 +78,47 @@ describe("versions --help", () => { -v, --version Show version number [boolean]" `); }); + + test("shows versions help w/ --help", async () => { + const result = runWrangler("versions --help"); + + await expect(result).resolves.toBeUndefined(); + + expect(std.out).toMatchInlineSnapshot(` + "wrangler versions + + 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare + + COMMANDS + wrangler versions view View the details of a specific version of your Worker [beta] + wrangler versions list List the 10 most recent Versions of your Worker [beta] + wrangler versions upload Uploads your Worker code and config as a new Version [beta] + wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] + wrangler versions secret Generate a secret that can be referenced in a Worker + + GLOBAL FLAGS + -j, --experimental-json-config Experimental: support wrangler.json [boolean] + -c, --config Path to .toml configuration file [string] + -e, --env Environment to use for operations and .env files [string] + -h, --help Show help [boolean] + -v, --version Show version number [boolean]" + `); + }); }); describe("versions subhelp", () => { const std = mockConsoleMethods(); - test("fails without --experimental-versions flag", async () => { - const result = runWrangler("versions"); + test("fails with --no-experimental-versions flag", async () => { + const result = runWrangler("versions --no-experimental-versions"); await expect(result).rejects.toMatchInlineSnapshot( `[Error: Unknown argument: versions]` ); }); - test("shows implicit subhelp with --experimental-versions flag", async () => { - const result = runWrangler("versions --experimental-versions"); + test("shows implicit subhelp", async () => { + const result = runWrangler("versions"); await expect(result).resolves.toBeUndefined(); await setImmediate(); // wait for subhelp @@ -100,7 +126,7 @@ describe("versions subhelp", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler versions - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare COMMANDS wrangler versions view View the details of a specific version of your Worker [beta] @@ -118,6 +144,33 @@ describe("versions subhelp", () => { `); }); + test("shows implicit subhelp with --experimental-versions flag", async () => { + const result = runWrangler("versions --experimental-versions"); + + await expect(result).resolves.toBeUndefined(); + await setImmediate(); // wait for subhelp + + expect(std.out).toMatchInlineSnapshot(` + "wrangler versions + + 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare + + COMMANDS + wrangler versions view View the details of a specific version of your Worker [beta] + wrangler versions list List the 10 most recent Versions of your Worker [beta] + wrangler versions upload Uploads your Worker code and config as a new Version [beta] + wrangler versions deploy [version-specs..] Safely roll out new Versions of your Worker by splitting traffic between multiple Versions [beta] + wrangler versions secret Generate a secret that can be referenced in a Worker + + GLOBAL FLAGS + -j, --experimental-json-config Experimental: support wrangler.json [boolean] + -c, --config Path to .toml configuration file [string] + -e, --env Environment to use for operations and .env files [string] + -h, --help Show help [boolean] + -v, --version Show version number [boolean]" + `); + }); + test("shows implicit subhelp with --x-versions flag", async () => { const result = runWrangler("versions --x-versions"); @@ -127,7 +180,7 @@ describe("versions subhelp", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler versions - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare COMMANDS wrangler versions view View the details of a specific version of your Worker [beta] @@ -154,7 +207,7 @@ describe("versions subhelp", () => { expect(std.out).toMatchInlineSnapshot(` "wrangler versions - 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare [open beta] + 🫧 List, view, upload and deploy Versions of your Worker to Cloudflare COMMANDS wrangler versions view View the details of a specific version of your Worker [beta] diff --git a/packages/wrangler/src/__tests__/versions/versions.list.test.ts b/packages/wrangler/src/__tests__/versions/versions.list.test.ts index 87b9424a019b..ec1ed7fa06f5 100644 --- a/packages/wrangler/src/__tests__/versions/versions.list.test.ts +++ b/packages/wrangler/src/__tests__/versions/versions.list.test.ts @@ -41,36 +41,36 @@ describe("versions list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "Version ID: 40000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload - Tag: - - Message: - + "Version ID: 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Upload + Tag: - + Message: - - Version ID: 30000000-0000-0000-0000-000000000000 - Created: 2021-02-02T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback - Tag: - - Message: Rolled back for this version + Version ID: 20000000-0000-0000-0000-000000000000 + Created: 2021-01-04T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Rollback + Tag: - + Message: - - Version ID: 20000000-0000-0000-0000-000000000000 - Created: 2021-02-03T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - Tag: - - Message: - + Version ID: 30000000-0000-0000-0000-000000000000 + Created: 2021-02-02T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Rollback + Tag: - + Message: Rolled back for this version - Version ID: 10000000-0000-0000-0000-000000000000 - Created: 2021-01-04T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback - Tag: - - Message: - + Version ID: 40000000-0000-0000-0000-000000000000 + Created: 2021-02-03T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Wrangler 🤠 + Tag: - + Message: - - " - `); + " + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -83,70 +83,70 @@ describe("versions list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "[ - { - \\"id\\": \\"40000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"1701-E\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"upload\\" - }, - \\"metadata\\": { - \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-01-01T00:00:00.000000Z\\" - } - }, - { - \\"id\\": \\"30000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"NCC-74656\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", - \\"workers/message\\": \\"Rolled back for this version\\" - }, - \\"metadata\\": { - \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-02-02T00:00:00.000000Z\\" - } - }, - { - \\"id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"NCC-74656\\", - \\"metadata\\": { - \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-02-03T00:00:00.000000Z\\" - } - }, - { - \\"id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"1701-E\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" - }, - \\"metadata\\": { - \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-01-04T00:00:00.000000Z\\" - }, - \\"resources\\": { - \\"script\\": \\"test-name\\", - \\"bindings\\": [] - } - } - ] - " - `); + "[ + { + \\"id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"1701-E\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"upload\\" + }, + \\"metadata\\": { + \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-01-01T00:00:00.000000Z\\" + } + }, + { + \\"id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"1701-E\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" + }, + \\"metadata\\": { + \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-01-04T00:00:00.000000Z\\" + }, + \\"resources\\": { + \\"script\\": \\"test-name\\", + \\"bindings\\": [] + } + }, + { + \\"id\\": \\"30000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"NCC-74656\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", + \\"workers/message\\": \\"Rolled back for this version\\" + }, + \\"metadata\\": { + \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-02-02T00:00:00.000000Z\\" + } + }, + { + \\"id\\": \\"40000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"NCC-74656\\", + \\"metadata\\": { + \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-02-03T00:00:00.000000Z\\" + } + } + ] + " + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -161,36 +161,36 @@ describe("versions list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "Version ID: 40000000-0000-0000-0000-000000000000 - Created: 2021-01-01T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Upload - Tag: - - Message: - + "Version ID: 10000000-0000-0000-0000-000000000000 + Created: 2021-01-01T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Upload + Tag: - + Message: - - Version ID: 30000000-0000-0000-0000-000000000000 - Created: 2021-02-02T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Rollback - Tag: - - Message: Rolled back for this version + Version ID: 20000000-0000-0000-0000-000000000000 + Created: 2021-01-04T00:00:00.000Z + Author: Jean-Luc-Picard@federation.org + Source: Rollback + Tag: - + Message: - - Version ID: 20000000-0000-0000-0000-000000000000 - Created: 2021-02-03T00:00:00.000Z - Author: Kathryn-Janeway@federation.org - Source: Wrangler 🤠 - Tag: - - Message: - + Version ID: 30000000-0000-0000-0000-000000000000 + Created: 2021-02-02T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Rollback + Tag: - + Message: Rolled back for this version - Version ID: 10000000-0000-0000-0000-000000000000 - Created: 2021-01-04T00:00:00.000Z - Author: Jean-Luc-Picard@federation.org - Source: Rollback - Tag: - - Message: - + Version ID: 40000000-0000-0000-0000-000000000000 + Created: 2021-02-03T00:00:00.000Z + Author: Kathryn-Janeway@federation.org + Source: Wrangler 🤠 + Tag: - + Message: - - " - `); + " + `); expect(std.err).toMatchInlineSnapshot(`""`); }); @@ -203,70 +203,70 @@ describe("versions list", () => { await expect(result).resolves.toBeUndefined(); expect(std.out).toMatchInlineSnapshot(` - "[ - { - \\"id\\": \\"40000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"1701-E\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"upload\\" - }, - \\"metadata\\": { - \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-01-01T00:00:00.000000Z\\" - } - }, - { - \\"id\\": \\"30000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"NCC-74656\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", - \\"workers/message\\": \\"Rolled back for this version\\" - }, - \\"metadata\\": { - \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-02-02T00:00:00.000000Z\\" - } - }, - { - \\"id\\": \\"20000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"NCC-74656\\", - \\"metadata\\": { - \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-02-03T00:00:00.000000Z\\" - } - }, - { - \\"id\\": \\"10000000-0000-0000-0000-000000000000\\", - \\"number\\": \\"1701-E\\", - \\"annotations\\": { - \\"workers/triggered_by\\": \\"rollback\\", - \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" - }, - \\"metadata\\": { - \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", - \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", - \\"source\\": \\"wrangler\\", - \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", - \\"modified_on\\": \\"2021-01-04T00:00:00.000000Z\\" - }, - \\"resources\\": { - \\"script\\": \\"test-name\\", - \\"bindings\\": [] - } - } - ] - " - `); + "[ + { + \\"id\\": \\"10000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"1701-E\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"upload\\" + }, + \\"metadata\\": { + \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-01-01T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-01-01T00:00:00.000000Z\\" + } + }, + { + \\"id\\": \\"20000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"1701-E\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-2222\\" + }, + \\"metadata\\": { + \\"author_id\\": \\"Picard-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Jean-Luc-Picard@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-01-04T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-01-04T00:00:00.000000Z\\" + }, + \\"resources\\": { + \\"script\\": \\"test-name\\", + \\"bindings\\": [] + } + }, + { + \\"id\\": \\"30000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"NCC-74656\\", + \\"annotations\\": { + \\"workers/triggered_by\\": \\"rollback\\", + \\"workers/rollback_from\\": \\"MOCK-DEPLOYMENT-ID-1111\\", + \\"workers/message\\": \\"Rolled back for this version\\" + }, + \\"metadata\\": { + \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-02-02T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-02-02T00:00:00.000000Z\\" + } + }, + { + \\"id\\": \\"40000000-0000-0000-0000-000000000000\\", + \\"number\\": \\"NCC-74656\\", + \\"metadata\\": { + \\"author_id\\": \\"Kathryn-Jane-Gamma-6-0-7-3\\", + \\"author_email\\": \\"Kathryn-Janeway@federation.org\\", + \\"source\\": \\"wrangler\\", + \\"created_on\\": \\"2021-02-03T00:00:00.000000Z\\", + \\"modified_on\\": \\"2021-02-03T00:00:00.000000Z\\" + } + } + ] + " + `); expect(std.err).toMatchInlineSnapshot(`""`); }); diff --git a/packages/wrangler/src/deploy/deploy.ts b/packages/wrangler/src/deploy/deploy.ts index b125950eb6fe..eded5aefc732 100644 --- a/packages/wrangler/src/deploy/deploy.ts +++ b/packages/wrangler/src/deploy/deploy.ts @@ -23,7 +23,6 @@ import { } from "../deployment-bundle/module-collection"; import { getNodeCompatMode } from "../deployment-bundle/node-compat"; import { loadSourceMaps } from "../deployment-bundle/source-maps"; -import { addHyphens } from "../deployments"; import { confirm } from "../dialogs"; import { getMigrationsToUpload } from "../durable"; import { UserError } from "../errors"; @@ -31,7 +30,7 @@ import { syncExperimentalAssets } from "../experimental-assets"; import { logger } from "../logger"; import { getMetricsUsageHeaders } from "../metrics"; import { isNavigatorDefined } from "../navigator-user-agent"; -import { APIError, ParseError } from "../parse"; +import { APIError, ParseError, parseNonHyphenedUuid } from "../parse"; import { getWranglerTmpDir } from "../paths"; import { ensureQueuesExistByConfig, @@ -47,7 +46,6 @@ import { maybeRetrieveFileSourceMap, } from "../sourcemap"; import triggersDeploy from "../triggers/deploy"; -import { logVersionIdChange } from "../utils/deployment-id-version-id-change"; import { confirmLatestDeploymentOverwrite } from "../versions/deploy"; import { getZoneForRoute } from "../zones"; import type { Config } from "../config"; @@ -68,6 +66,7 @@ import type { import type { PostQueueBody, PostTypedConsumerBody } from "../queues/client"; import type { LegacyAssetPaths } from "../sites"; import type { RetrieveSourceMapFunction } from "../sourcemap"; +import type { ApiVersion } from "../versions/types"; type Props = { config: Config; @@ -311,14 +310,16 @@ Update them to point to this script instead?`; export default async function deploy(props: Props): Promise<{ sourceMapSize?: number; - deploymentId: string | null; + versionId: string | null; workerTag: string | null; targets?: string[]; }> { // TODO: warn if git/hg has uncommitted changes const { config, accountId, name } = props; let workerTag: string | null = null; - let deploymentId: string | null = null; + let versionId: string | null = null; + + let workerExists: boolean = true; if (!props.dispatchNamespace && accountId && name) { try { @@ -340,14 +341,14 @@ export default async function deploy(props: Props): Promise<{ `You are about to publish a Workers Service that was last published via the Cloudflare Dashboard.\nEdits that have been made via the dashboard will be overridden by your local code and config.` ); if (!(await confirm("Would you like to continue?"))) { - return { deploymentId, workerTag }; + return { versionId, workerTag }; } } else if (script.last_deployed_from === "api") { logger.warn( `You are about to publish a Workers Service that was last updated via the script API.\nEdits that have been made via the script API will be overridden by your local code and config.` ); if (!(await confirm("Would you like to continue?"))) { - return { deploymentId, workerTag }; + return { versionId, workerTag }; } } } catch (e) { @@ -355,6 +356,8 @@ export default async function deploy(props: Props): Promise<{ // is thrown from the above fetchResult on the first deploy of a Worker if ((e as { code?: number }).code !== 10090) { throw e; + } else { + workerExists = false; } } } @@ -454,7 +457,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m const yes = await confirmLatestDeploymentOverwrite(accountId, scriptName); if (!yes) { cancel("Aborting deploy..."); - return { deploymentId, workerTag }; + return { versionId, workerTag }; } } @@ -719,6 +722,23 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m } } + // We can use the new versions/deployments APIs if we: + // * have --x-versions enabled (default, but can be disabled with --no-x-versions) + // * are uploading a worker that already exists + // * aren't a dispatch namespace deploy + // * aren't a service env deploy + // * aren't a service Worker + // * we don't have DO migrations + // * we aren't an fpw + const canUseNewVersionsDeploymentsApi = + props.experimentalVersions && + workerExists && + props.dispatchNamespace === undefined && + prod && + format === "modules" && + migrations === undefined && + !config.first_party_worker; + if (props.dryRun) { printBindings({ ...withoutStaticAssets, vars: maskedVars }); } else { @@ -728,34 +748,89 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m // Upload the script so it has time to propagate. // We can also now tell whether available_on_subdomain is set try { - const result = await fetchResult<{ + let result: { available_on_subdomain: boolean; id: string | null; etag: string | null; pipeline_hash: string | null; mutable_pipeline_id: string | null; deployment_id: string | null; - startup_time_ms: number; - }>( - workerUrl, - { - method: "PUT", - body: createWorkerUploadForm(worker), - headers: await getMetricsUsageHeaders(config.send_metrics), - }, - new URLSearchParams({ - include_subdomain_availability: "true", - // pass excludeScript so the whole body of the - // script doesn't get included in the response - excludeScript: "true", - }) - ); + startup_time_ms?: number; + }; - logger.log("Worker Startup Time:", result.startup_time_ms, "ms"); + // If we're using the new APIs, first upload the version + if (canUseNewVersionsDeploymentsApi) { + const versionResult = await fetchResult( + `/accounts/${accountId}/workers/scripts/${scriptName}/versions`, + { + method: "POST", + body: createWorkerUploadForm(worker), + headers: await getMetricsUsageHeaders(config.send_metrics), + } + ); + + await fetchResult( + `/accounts/${accountId}/workers/scripts/${scriptName}/deployments`, + { + method: "POST", + body: JSON.stringify({ + stratergy: "percentage", + versions: [ + { + percentage: 100, + version_id: versionResult.id, + }, + ], + }), + headers: await getMetricsUsageHeaders(config.send_metrics), + } + ); + + const { available_on_subdomain } = await fetchResult<{ + available_on_subdomain: boolean; + }>(`/accounts/${accountId}/workers/scripts/${scriptName}/subdomain`); + + result = { + available_on_subdomain, + id: null, // fpw - ignore + etag: versionResult.resources.script.etag, + pipeline_hash: null, // fpw - ignore + mutable_pipeline_id: null, // fpw - ignore + deployment_id: versionResult.id, // version id not deployment id but easier to adapt here + startup_time_ms: versionResult.startup_time_ms, + }; + } else { + result = await fetchResult<{ + available_on_subdomain: boolean; + id: string | null; + etag: string | null; + pipeline_hash: string | null; + mutable_pipeline_id: string | null; + deployment_id: string | null; + startup_time_ms: number; + }>( + workerUrl, + { + method: "PUT", + body: createWorkerUploadForm(worker), + headers: await getMetricsUsageHeaders(config.send_metrics), + }, + new URLSearchParams({ + include_subdomain_availability: "true", + // pass excludeScript so the whole body of the + // script doesn't get included in the response + excludeScript: "true", + }) + ); + } + + if (result.startup_time_ms) { + logger.log("Worker Startup Time:", result.startup_time_ms, "ms"); + } bindingsPrinted = true; printBindings({ ...withoutStaticAssets, vars: maskedVars }); - deploymentId = addHyphens(result.deployment_id) ?? result.deployment_id; + versionId = parseNonHyphenedUuid(result.deployment_id); if (config.first_party_worker) { // Print some useful information returned after publishing @@ -840,7 +915,7 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m if (props.dryRun) { logger.log(`--dry-run: exiting now.`); - return { deploymentId, workerTag }; + return { versionId, workerTag }; } assert(accountId, "Missing accountId"); @@ -850,21 +925,18 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m // Early exit for WfP since it doesn't need the below code if (props.dispatchNamespace !== undefined) { - deployWfpUserWorker(props.dispatchNamespace, deploymentId); - return { deploymentId, workerTag }; + deployWfpUserWorker(props.dispatchNamespace, versionId); + return { versionId, workerTag }; } // deploy triggers const targets = await triggersDeploy(props); - logger.log("Current Deployment ID:", deploymentId); - logger.log("Current Version ID:", deploymentId); - - logVersionIdChange(); + logger.log("Current Version ID:", versionId); return { sourceMapSize, - deploymentId, + versionId, workerTag, targets: targets ?? [], }; @@ -872,14 +944,11 @@ See https://developers.cloudflare.com/workers/platform/compatibility-dates for m function deployWfpUserWorker( dispatchNamespace: string, - deploymentId: string | null + versionId: string | null ) { // Will go under the "Uploaded" text logger.log(" Dispatch Namespace:", dispatchNamespace); - logger.log("Current Deployment ID:", deploymentId); - logger.log("Current Version ID:", deploymentId); - - logVersionIdChange(); + logger.log("Current Version ID:", versionId); } export function helpIfErrorIsSizeOrScriptStartup( diff --git a/packages/wrangler/src/deploy/index.ts b/packages/wrangler/src/deploy/index.ts index 6a7d1a6d0322..6c3370918ab3 100644 --- a/packages/wrangler/src/deploy/index.ts +++ b/packages/wrangler/src/deploy/index.ts @@ -326,7 +326,7 @@ export async function deployHandler( const beforeUpload = Date.now(); const name = getScriptName(args, config); - const { sourceMapSize, deploymentId, workerTag, targets } = await deploy({ + const { sourceMapSize, versionId, workerTag, targets } = await deploy({ config, accountId, name, @@ -368,8 +368,7 @@ export async function deployHandler( version: 1, worker_name: name ?? null, worker_tag: workerTag, - // Note that the `deploymentId` returned from a simple deployment is actually the versionId of the uploaded version. - version_id: deploymentId, + version_id: versionId, targets, }); diff --git a/packages/wrangler/src/deployments.ts b/packages/wrangler/src/deployments.ts index 300d2a90600b..f333b53bf382 100644 --- a/packages/wrangler/src/deployments.ts +++ b/packages/wrangler/src/deployments.ts @@ -10,7 +10,6 @@ import { mapBindings } from "./init"; import { logger } from "./logger"; import * as metrics from "./metrics"; import { requireAuth } from "./user"; -import { logVersionIdChange } from "./utils/deployment-id-version-id-change"; import { getScriptName, printWranglerBanner } from "."; import type { Config } from "./config"; import type { WorkerMetadataBinding } from "./deployment-bundle/create-worker-upload-form"; @@ -85,7 +84,6 @@ export async function deployments( : `${formatSource(versions.metadata.source)}`; let version = ` -Deployment ID: ${versions.id} Version ID: ${versions.id} Created on: ${versions.metadata.created_on} Author: ${versions.metadata.author_email} @@ -104,8 +102,6 @@ Source: ${triggerStr}`; versionMessages[versionMessages.length - 1] += "🟩 Active"; logger.log(...versionMessages); - - logVersionIdChange(); } function formatSource(source: string): string { @@ -213,10 +209,7 @@ export async function rollbackDeployment( rollbackVersion = addHyphens(rollbackVersion) ?? rollbackVersion; logger.log(`\nSuccessfully rolled back to Deployment ID: ${deploymentId}`); - logger.log("Current Deployment ID:", rollbackVersion); logger.log("Current Version ID:", rollbackVersion); - - logVersionIdChange(); } async function rollbackRequest( @@ -305,7 +298,6 @@ export async function viewDeployment( const bindings = deploymentDetails.resources.bindings; const version = ` -Deployment ID: ${deploymentDetails.id} Version ID: ${deploymentDetails.id} Created on: ${deploymentDetails.metadata.created_on} Author: ${deploymentDetails.metadata.author_email} @@ -325,13 +317,10 @@ ${ `; logger.log(version); - - logVersionIdChange(); } export async function commonDeploymentCMDSetup( - yargs: ArgumentsCamelCase, - deploymentsWarning: string + yargs: ArgumentsCamelCase ) { await printWranglerBanner(); const config = readConfig(yargs.config, yargs); @@ -341,7 +330,6 @@ export async function commonDeploymentCMDSetup( config ); - logger.log(`${deploymentsWarning}\n`); if (!scriptName) { throw new UserError( "Required Worker name missing. Please specify the Worker name in wrangler.toml, or pass it as an argument with `--name`" diff --git a/packages/wrangler/src/index.ts b/packages/wrangler/src/index.ts index d79a180d5f14..389916d1ebb8 100644 --- a/packages/wrangler/src/index.ts +++ b/packages/wrangler/src/index.ts @@ -186,11 +186,11 @@ export class CommandLineArgsError extends UserError {} export function createCLIParser(argv: string[]) { const experimentalGradualRollouts = // original flag -- using internal product name (Gradual Rollouts) -- kept for temp back-compat - argv.includes("--experimental-gradual-rollouts") || + !argv.includes("--no-experimental-gradual-rollouts") && // new flag -- using external product name (Versions) - argv.includes("--experimental-versions") || + !argv.includes("--no-experimental-versions") && // new flag -- shorthand - argv.includes("--x-versions"); + !argv.includes("--no-x-versions"); // Type check result against CommonYargsOptions to make sure we've included // all common options @@ -239,6 +239,7 @@ export function createCLIParser(argv: string[]) { .option("experimental-versions", { describe: `Experimental: support Worker Versions`, type: "boolean", + default: true, hidden: true, alias: ["x-versions", "experimental-gradual-rollouts"], }) @@ -369,20 +370,16 @@ export function createCLIParser(argv: string[]) { deployHandler ); - // [OPEN BETA] deployments - const deploymentsWarning = - "🚧`wrangler deployments` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose"; - const deploymentsDescription = `🚢 List and view the current and past deployments for your Worker ${chalk.hex(betaCmdColor)("[open beta]")}`; + // deployments + const deploymentsDescription = + "🚢 List and view the current and past deployments for your Worker"; if (experimentalGradualRollouts) { - wrangler - .command( - "deployments", - deploymentsDescription, - registerVersionsDeploymentsSubcommands - ) - .command(subHelp) - .epilogue(deploymentsWarning); + wrangler.command( + "deployments", + deploymentsDescription, + registerVersionsDeploymentsSubcommands + ); } else { wrangler.command("deployments", deploymentsDescription, (yargs) => yargs @@ -396,7 +393,7 @@ export function createCLIParser(argv: string[]) { async (listYargs) => listYargs, async (listYargs) => { const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(listYargs, deploymentsWarning); + await commonDeploymentCMDSetup(listYargs); await deployments(accountId, scriptName, config); } ) @@ -411,7 +408,7 @@ export function createCLIParser(argv: string[]) { }), async (viewYargs) => { const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(viewYargs, deploymentsWarning); + await commonDeploymentCMDSetup(viewYargs); await viewDeployment( accountId, @@ -422,22 +419,14 @@ export function createCLIParser(argv: string[]) { } ) .command(subHelp) - .epilogue(deploymentsWarning) ); } - // [OPEN BETA] rollback - const rollbackWarning = - "🚧`wrangler rollback` is a beta command. Please report any issues to https://github.com/cloudflare/workers-sdk/issues/new/choose"; - const rollbackDescription = `🔙 Rollback a deployment for a Worker ${chalk.hex(betaCmdColor)("[open beta]")}`; + // rollback + const rollbackDescription = "🔙 Rollback a deployment for a Worker"; if (experimentalGradualRollouts) { - registerVersionsRollbackCommand( - wrangler, - rollbackWarning, - subHelp, - rollbackDescription - ); + registerVersionsRollbackCommand(wrangler, rollbackDescription); } else { wrangler.command( "rollback [deployment-id]", @@ -459,11 +448,10 @@ export function createCLIParser(argv: string[]) { .option("name", { describe: "The name of your Worker", type: "string", - }) - .epilogue(rollbackWarning), + }), async (rollbackYargs) => { const { accountId, scriptName, config } = - await commonDeploymentCMDSetup(rollbackYargs, rollbackWarning); + await commonDeploymentCMDSetup(rollbackYargs); await rollbackDeployment( accountId, @@ -476,22 +464,22 @@ export function createCLIParser(argv: string[]) { ); } - // [OPEN BETA] versions + // versions if (experimentalGradualRollouts) { wrangler.command( "versions", - `🫧 List, view, upload and deploy Versions of your Worker to Cloudflare ${chalk.hex(betaCmdColor)("[open beta]")}`, + "🫧 List, view, upload and deploy Versions of your Worker to Cloudflare", (yargs) => { return registerVersionsSubcommands(yargs.command(subHelp), subHelp); } ); } - // [OPEN BETA] triggers + // triggers if (experimentalGradualRollouts) { wrangler.command( "triggers", - `🎯 Updates the triggers of your current deployment ${chalk.hex(betaCmdColor)("[open beta]")}`, + "🎯 Updates the triggers of your current deployment", (yargs) => { return registerTriggersSubcommands(yargs.command(subHelp)); } diff --git a/packages/wrangler/src/parse.ts b/packages/wrangler/src/parse.ts index 3c2a58a7dab1..9a4751f216f5 100644 --- a/packages/wrangler/src/parse.ts +++ b/packages/wrangler/src/parse.ts @@ -337,3 +337,25 @@ export function parseHumanDuration(s: string): number { } return Number(s) * base; } + +export function parseNonHyphenedUuid(uuid: string | null): string | null { + if (uuid == null || uuid.includes("-")) { + return uuid; + } + + if (uuid.length != 32) { + return null; + } + + const uuid_parts: string[] = []; + uuid_parts.push(uuid.slice(0, 8)); + uuid_parts.push(uuid.slice(8, 12)); + uuid_parts.push(uuid.slice(12, 16)); + uuid_parts.push(uuid.slice(16, 20)); + uuid_parts.push(uuid.slice(20)); + + let hyphenated = ""; + uuid_parts.forEach((part) => (hyphenated += part + "-")); + + return hyphenated.slice(0, 36); +} diff --git a/packages/wrangler/src/utils/deployment-id-version-id-change.ts b/packages/wrangler/src/utils/deployment-id-version-id-change.ts deleted file mode 100644 index 927ba8803cb2..000000000000 --- a/packages/wrangler/src/utils/deployment-id-version-id-change.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { logger } from "../logger"; - -export function logVersionIdChange() { - const docsLink = - "https://developers.cloudflare.com/workers/configuration/versions-and-deployments"; - - logger.log( - `\n\nNote: Deployment ID has been renamed to Version ID. Deployment ID is present to maintain compatibility with the previous behavior of this command. This output will change in a future version of Wrangler. To learn more visit: ${docsLink}` - ); -} diff --git a/packages/wrangler/src/versions/deployments/list.ts b/packages/wrangler/src/versions/deployments/list.ts index 2f4b092f40a2..82e52bd7d744 100644 --- a/packages/wrangler/src/versions/deployments/list.ts +++ b/packages/wrangler/src/versions/deployments/list.ts @@ -59,7 +59,9 @@ export async function versionsDeploymentsListHandler( ); } - const deployments = await fetchLatestDeployments(accountId, workerName); + const deployments = ( + await fetchLatestDeployments(accountId, workerName) + ).sort((a, b) => a.created_on.localeCompare(b.created_on)); if (args.json) { logRaw(JSON.stringify(deployments, null, 2)); diff --git a/packages/wrangler/src/versions/list.ts b/packages/wrangler/src/versions/list.ts index 6f0686812a53..4ad0a9fbf158 100644 --- a/packages/wrangler/src/versions/list.ts +++ b/packages/wrangler/src/versions/list.ts @@ -57,11 +57,9 @@ export async function versionsListHandler(args: VersionsListArgs) { } const versionCache: VersionCache = new Map(); - const versions = await fetchDeployableVersions( - accountId, - workerName, - versionCache - ); + const versions = ( + await fetchDeployableVersions(accountId, workerName, versionCache) + ).sort((a, b) => a.metadata.created_on.localeCompare(b.metadata.created_on)); if (args.json) { logRaw(JSON.stringify(versions, null, 2)); diff --git a/packages/wrangler/src/versions/rollback/index.ts b/packages/wrangler/src/versions/rollback/index.ts index ca256486be5b..7c79a273ead7 100644 --- a/packages/wrangler/src/versions/rollback/index.ts +++ b/packages/wrangler/src/versions/rollback/index.ts @@ -11,7 +11,6 @@ import { getConfig } from "../list"; import type { CommonYargsArgv, StrictYargsOptionsToInterface, - SubHelp, } from "../../yargs-types"; import type { VersionId } from "../types"; @@ -23,19 +22,14 @@ export type VersionsRollbackArgs = StrictYargsOptionsToInterface< export default function registerVersionsRollbackCommand( yargs: CommonYargsArgv, - epilogue: string, - subHelp: SubHelp, description = "🔙 Rollback to a Worker Version" ) { - return yargs - .command( - "rollback [version-id]", - description, - versionsRollbackOptions, - versionsRollbackHandler - ) - .command(subHelp) - .epilogue(epilogue); + return yargs.command( + "rollback [version-id]", + description, + versionsRollbackOptions, + versionsRollbackHandler + ); } export function versionsRollbackOptions(rollbackYargs: CommonYargsArgv) { @@ -151,6 +145,8 @@ export async function versionsRollbackHandler(args: VersionsRollbackArgs) { cli.success( `Worker Version ${versionId} has been deployed to 100% of traffic.` ); + + logger.log("\nCurrent Version ID: " + versionId); } async function fetchDefaultRollbackVersionId( diff --git a/packages/wrangler/src/versions/types.ts b/packages/wrangler/src/versions/types.ts index b1c167efc0bb..b69a76dbde65 100644 --- a/packages/wrangler/src/versions/types.ts +++ b/packages/wrangler/src/versions/types.ts @@ -47,6 +47,7 @@ export type ApiVersion = { limits: CfUserLimits; }; }; + startup_time_ms?: number; }; export type VersionCache = Map;