From 5b87b85f869a1ce31da1abd603c6358e4acb971a Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 24 Nov 2025 15:25:43 +0000 Subject: [PATCH 1/7] pin the Typescript version --- pnpm-lock.yaml | 2 +- pnpm-workspace.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4942711cab0a..256d2b298f8a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,7 +40,7 @@ catalogs: specifier: ^1.5.2 version: 1.5.2 typescript: - specifier: ^5.8.3 + specifier: 5.8.x version: 5.8.3 undici: specifier: 7.14.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 9ba8efea9831..941fbbca4dc2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -24,7 +24,7 @@ catalog: "@vitest/ui": ~3.2.0 # rimraf@6 requires node 20 or >=22 rimraf: "^6.0.1" - typescript: "^5.8.3" + typescript: "5.8.x" undici: "7.14.0" # Override undici-types from @types/node so that the Cloudflare SDK typings match our installed # version of Undici From eadd396aee455daaa0c16cf36fe1d772ee8dc416 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 18 Nov 2025 17:01:26 +0000 Subject: [PATCH 2/7] add error message info to debug where we are getting the api token from --- .../wrangler/src/__tests__/deploy.test.ts | 20 ++++++++++++------- .../wrangler/src/__tests__/whoami.test.ts | 11 +++++++--- packages/wrangler/src/user/user.ts | 3 ++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/wrangler/src/__tests__/deploy.test.ts b/packages/wrangler/src/__tests__/deploy.test.ts index d7131f78f611..3bbeda16fa58 100644 --- a/packages/wrangler/src/__tests__/deploy.test.ts +++ b/packages/wrangler/src/__tests__/deploy.test.ts @@ -733,15 +733,21 @@ describe("deploy", () => { 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. - This is no longer supported in the current version of Wrangler. - If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` - environment variable. + // The current working directory is replaced with `` to make the snapshot consistent across environments + // But since the actual working directory could be a long string on some operating systems it is possible that the string gets wrapped to a new line. + // To avoid failures across different environments, we remove any newline before `` in the snapshot. + expect(std.warn.replaceAll(/from[ \r\n]+/g, "from ")) + .toMatchInlineSnapshot(` + "▲ [WARNING] It looks like you have used Wrangler v1's \`config\` command to login with an API token - " - `); + from /home/.config/.wrangler/config/default.toml. + This is no longer supported in the current version of Wrangler. + If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` + environment variable. + + " + `); expect(std.err).toMatchInlineSnapshot(`""`); }); diff --git a/packages/wrangler/src/__tests__/whoami.test.ts b/packages/wrangler/src/__tests__/whoami.test.ts index 0c43b56f8eb2..9d1ea018fc35 100644 --- a/packages/wrangler/src/__tests__/whoami.test.ts +++ b/packages/wrangler/src/__tests__/whoami.test.ts @@ -198,9 +198,14 @@ describe("getUserInfo(COMPLIANCE_REGION_CONFIG_UNKNOWN)", () => { writeAuthConfigFile({ api_token: "API_TOKEN" }); await getUserInfo(COMPLIANCE_REGION_CONFIG_UNKNOWN); - expect(std.warn).toMatchInlineSnapshot(` - "▲ [WARNING] It looks like you have used Wrangler v1's \`config\` command to login with an API token. - + // The current working directory is replaced with `` to make the snapshot consistent across environments + // But since the actual working directory could be a long string on some operating systems it is possible that the string gets wrapped to a new line. + // To avoid failures across different environments, we remove any newline before `` in the snapshot. + expect(std.warn.replaceAll(/from[ \r\n]+/g, "from ")) + .toMatchInlineSnapshot(` + "▲ [WARNING] It looks like you have used Wrangler v1's \`config\` command to login with an API token + + from /home/.config/.wrangler/config/default.toml. This is no longer supported in the current version of Wrangler. If you wish to authenticate via an API token then please set the \`CLOUDFLARE_API_TOKEN\` environment variable. diff --git a/packages/wrangler/src/user/user.ts b/packages/wrangler/src/user/user.ts index 820f5541cefb..119d2bf5fa4b 100644 --- a/packages/wrangler/src/user/user.ts +++ b/packages/wrangler/src/user/user.ts @@ -422,7 +422,8 @@ function getAuthTokens(config?: UserAuthConfig): AuthTokens | undefined { }; } else if (api_token) { logger.warn( - "It looks like you have used Wrangler v1's `config` command to login with an API token.\n" + + "It looks like you have used Wrangler v1's `config` command to login with an API token\n" + + `from ${config === undefined ? getAuthConfigFilePath() : "in-memory config"}.\n` + "This is no longer supported in the current version of Wrangler.\n" + "If you wish to authenticate via an API token then please set the `CLOUDFLARE_API_TOKEN` environment variable." ); From 9c31c2b1b72329db4112a4d0a2504d7631ff3af0 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 24 Nov 2025 16:15:41 +0000 Subject: [PATCH 3/7] allow C3 to import from workers-utils --- packages/create-cloudflare/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-cloudflare/tsconfig.json b/packages/create-cloudflare/tsconfig.json index 4cc1c6a96f7f..e369248865cd 100644 --- a/packages/create-cloudflare/tsconfig.json +++ b/packages/create-cloudflare/tsconfig.json @@ -14,7 +14,7 @@ "compilerOptions": { "target": "ESNext", "module": "preserve", - "moduleResolution": "node", + "moduleResolution": "bundler", "allowJs": true, "strict": true, "esModuleInterop": true, From 50711997e89a8002d4e20590ecf7f34c12388756 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 24 Nov 2025 17:23:57 +0000 Subject: [PATCH 4/7] clean up vitest config --- packages/workers-utils/tests/vitest.setup.ts | 6 ------ packages/workers-utils/vitest.config.mts | 4 +--- 2 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 packages/workers-utils/tests/vitest.setup.ts diff --git a/packages/workers-utils/tests/vitest.setup.ts b/packages/workers-utils/tests/vitest.setup.ts deleted file mode 100644 index ecbcbaa12014..000000000000 --- a/packages/workers-utils/tests/vitest.setup.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { afterEach, vi } from "vitest"; - -afterEach(() => { - // It is important that we clear mocks between tests to avoid leakage. - vi.clearAllMocks(); -}); diff --git a/packages/workers-utils/vitest.config.mts b/packages/workers-utils/vitest.config.mts index 3a626b828c38..cd09d35c0be6 100644 --- a/packages/workers-utils/vitest.config.mts +++ b/packages/workers-utils/vitest.config.mts @@ -5,16 +5,14 @@ export default defineConfig({ test: { testTimeout: 15_000, pool: "forks", - retry: 0, include: ["**/tests/**/*.test.ts"], - setupFiles: path.resolve(__dirname, "tests/vitest.setup.ts"), globalSetup: path.resolve(__dirname, "tests/vitest.global.ts"), reporters: ["default"], - globals: true, snapshotFormat: { escapeString: true, printBasicPrototype: true, }, unstubEnvs: true, + mockReset: true, }, }); From be6ded0d1462e27b13879d7260e8b830a606b5ff Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Thu, 23 Oct 2025 12:01:08 +0100 Subject: [PATCH 5/7] Add PWD to turbo's global pass-through env --- turbo.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/turbo.json b/turbo.json index 20377dd0304c..b26568ea78ad 100644 --- a/turbo.json +++ b/turbo.json @@ -5,17 +5,18 @@ }, "globalEnv": ["CI_OS", "NODE_VERSION"], "globalPassThroughEnv": [ - "NODE_EXTRA_CA_CERTS", "CI", - "VSCODE_INSPECTOR_OPTIONS", - "WRANGLER_LOG_PATH", - "TEST_REPORT_PATH", "CLOUDFLARE_CONTAINER_REGISTRY", "DOCKER_HOST", - "WRANGLER_DOCKER_HOST", - "WRANGLER_LOG", + "LOCAL_TESTS_WITHOUT_DOCKER", + "NODE_EXTRA_CA_CERTS", + "PWD", + "TEST_REPORT_PATH", + "VSCODE_INSPECTOR_OPTIONS", "WRANGLER_API_ENVIRONMENT", - "LOCAL_TESTS_WITHOUT_DOCKER" + "WRANGLER_DOCKER_HOST", + "WRANGLER_LOG_PATH", + "WRANGLER_LOG" ], "tasks": { "dev": { From f32883f32144178939507e6140e9f70937603aa1 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 8 Dec 2025 11:30:53 +0000 Subject: [PATCH 6/7] post review fixups --- pnpm-lock.yaml | 2 +- pnpm-workspace.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 256d2b298f8a..7afe4c804725 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,7 +40,7 @@ catalogs: specifier: ^1.5.2 version: 1.5.2 typescript: - specifier: 5.8.x + specifier: ~5.8.3 version: 5.8.3 undici: specifier: 7.14.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 941fbbca4dc2..a0fe279431ed 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -24,7 +24,7 @@ catalog: "@vitest/ui": ~3.2.0 # rimraf@6 requires node 20 or >=22 rimraf: "^6.0.1" - typescript: "5.8.x" + typescript: "~5.8.3" undici: "7.14.0" # Override undici-types from @types/node so that the Cloudflare SDK typings match our installed # version of Undici From 19f84c157ae7853c736edcc83437c7dfb4038190 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 8 Dec 2025 11:50:11 +0000 Subject: [PATCH 7/7] add changeset --- .changeset/ready-humans-thank.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ready-humans-thank.md diff --git a/.changeset/ready-humans-thank.md b/.changeset/ready-humans-thank.md new file mode 100644 index 000000000000..296010930657 --- /dev/null +++ b/.changeset/ready-humans-thank.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +add extra logging to user log-in flow for diagnosing failed login requests