-
Notifications
You must be signed in to change notification settings - Fork 1k
Wrangler preview urls e2e fixes and warning follow up #10561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dario-piotrowicz
merged 2 commits into
cloudflare:main
from
danielrs:drivas/wrangler-preview-urls-default-follow-up
Sep 17, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "wrangler": patch | ||
| --- | ||
|
|
||
| Do not show subdomain status mismatch warnings on first deploy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| import dedent from "ts-dedent"; | ||
| import { afterAll, beforeAll, describe, expect, it } from "vitest"; | ||
| import { CLOUDFLARE_ACCOUNT_ID } from "./helpers/account-id"; | ||
| import { WranglerE2ETestHelper } from "./helpers/e2e-wrangler-test"; | ||
| import { generateResourceName } from "./helpers/generate-resource-name"; | ||
| import { normalizeOutput } from "./helpers/normalize"; | ||
|
|
||
| const TIMEOUT = 50_000; | ||
| const workerName = generateResourceName(); | ||
| const normalize = (str: string) => | ||
| normalizeOutput(str, { | ||
| [CLOUDFLARE_ACCOUNT_ID]: "CLOUDFLARE_ACCOUNT_ID", | ||
| }).replaceAll(/^Author:.*$/gm, "Author: [email protected]"); | ||
|
|
||
| describe.skipIf(!CLOUDFLARE_ACCOUNT_ID)("deploy", { timeout: TIMEOUT }, () => { | ||
| let helper: WranglerE2ETestHelper; | ||
| beforeAll(async () => { | ||
| helper = new WranglerE2ETestHelper(); | ||
| }); | ||
|
|
||
| describe("subdomain warnings", () => { | ||
| beforeAll(async () => { | ||
| await helper.seed({ | ||
| "wrangler.toml": dedent` | ||
| name = "${workerName}" | ||
| main = "src/index.ts" | ||
| compatibility_date = "2023-01-01" | ||
| `, | ||
| "src/index.ts": dedent` | ||
| export default { | ||
| fetch(request) { | ||
| return new Response("Hello World!") | ||
| } | ||
| } | ||
| `, | ||
| "package.json": dedent` | ||
| { | ||
| "name": "${workerName}", | ||
| "version": "0.0.0", | ||
| "private": true | ||
| } | ||
| `, | ||
| }); | ||
| }); | ||
|
|
||
| afterAll(async () => { | ||
| await helper.run(`wrangler delete`); | ||
| }); | ||
|
|
||
| it("omit subdomain warnings on 1st deploy", async () => { | ||
| const deploy = await helper.run("wrangler deploy"); | ||
| expect(normalize(deploy.stdout)).toMatchInlineSnapshot(` | ||
| "Total Upload: xx KiB / gzip: xx KiB | ||
| Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS) | ||
| Deployed tmp-e2e-worker-00000000-0000-0000-0000-000000000000 triggers (TIMINGS) | ||
| https://tmp-e2e-worker-00000000-0000-0000-0000-000000000000.SUBDOMAIN.workers.dev | ||
| Current Version ID: 00000000-0000-0000-0000-000000000000" | ||
| `); | ||
| expect(normalize(deploy.stderr)).toMatchInlineSnapshot(`""`); | ||
| }); | ||
|
|
||
| it("show subdomain warnings on 2nd deploy, remote enabled", async () => { | ||
| // Set remote state using `wrangler triggers deploy`. | ||
| await helper.seed({ | ||
| "wrangler.toml": dedent` | ||
| name = "${workerName}" | ||
| main = "src/index.ts" | ||
| compatibility_date = "2023-01-01" | ||
| workers_dev = true | ||
| preview_urls = true | ||
| `, | ||
| }); | ||
| await helper.run("wrangler triggers deploy"); | ||
| // Remove `workers_dev` and `preview_urls` props, and redeploy. | ||
| await helper.seed({ | ||
| "wrangler.toml": dedent` | ||
| name = "${workerName}" | ||
| main = "src/index.ts" | ||
| compatibility_date = "2023-01-01" | ||
| `, | ||
| }); | ||
| const deploy = await helper.run("wrangler deploy"); | ||
| expect(normalize(deploy.stdout)).toMatchInlineSnapshot(` | ||
| "Total Upload: xx KiB / gzip: xx KiB | ||
| Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS) | ||
| Deployed tmp-e2e-worker-00000000-0000-0000-0000-000000000000 triggers (TIMINGS) | ||
| https://tmp-e2e-worker-00000000-0000-0000-0000-000000000000.SUBDOMAIN.workers.dev | ||
| Current Version ID: 00000000-0000-0000-0000-000000000000" | ||
| `); | ||
| expect(normalize(deploy.stderr)).toMatchInlineSnapshot(` | ||
| "▲ [WARNING] Worker has preview URLs enabled, but 'preview_urls' is not in the config. | ||
| Using default config 'preview_urls = false', current status will be overwritten." | ||
| `); | ||
| }); | ||
|
|
||
| it("show subdomain warnings on 3rd deploy, remote disabled", async () => { | ||
| // Set remote state using `wrangler triggers deploy`. | ||
| await helper.seed({ | ||
| "wrangler.toml": dedent` | ||
| name = "${workerName}" | ||
| main = "src/index.ts" | ||
| compatibility_date = "2023-01-01" | ||
| workers_dev = false | ||
| preview_urls = false | ||
| `, | ||
| }); | ||
| await helper.run("wrangler triggers deploy"); | ||
| // Remove `workers_dev` and `preview_urls` props, and redeploy. | ||
| await helper.seed({ | ||
danielrs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "wrangler.toml": dedent` | ||
| name = "${workerName}" | ||
| main = "src/index.ts" | ||
| compatibility_date = "2023-01-01" | ||
| `, | ||
| }); | ||
| const deploy = await helper.run("wrangler deploy"); | ||
| expect(normalize(deploy.stdout)).toMatchInlineSnapshot(` | ||
| "Total Upload: xx KiB / gzip: xx KiB | ||
| Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS) | ||
| Deployed tmp-e2e-worker-00000000-0000-0000-0000-000000000000 triggers (TIMINGS) | ||
| https://tmp-e2e-worker-00000000-0000-0000-0000-000000000000.SUBDOMAIN.workers.dev | ||
| Current Version ID: 00000000-0000-0000-0000-000000000000" | ||
| `); | ||
| expect(normalize(deploy.stderr)).toMatchInlineSnapshot(` | ||
| "▲ [WARNING] Worker has workers.dev disabled, but 'workers_dev' is not in the config. | ||
| Using default config 'workers_dev = true', current status will be overwritten." | ||
| `); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.