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

Filter by extension

Filter by extension


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

add extra logging to user log-in flow for diagnosing failed login requests
2 changes: 1 addition & 1 deletion packages/create-cloudflare/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"compilerOptions": {
"target": "ESNext",
"module": "preserve",
"moduleResolution": "node",
"moduleResolution": "bundler",
"allowJs": true,
"strict": true,
"esModuleInterop": true,
Expand Down
6 changes: 0 additions & 6 deletions packages/workers-utils/tests/vitest.setup.ts

This file was deleted.

4 changes: 1 addition & 3 deletions packages/workers-utils/vitest.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: I tried that across the repo and it failed (I have a closed PR)

snapshotFormat: {
escapeString: true,
printBasicPrototype: true,
},
unstubEnvs: true,
mockReset: true,
},
});
20 changes: 13 additions & 7 deletions packages/wrangler/src/__tests__/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<cwd>` 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 `<cwd>` in the snapshot.
expect(std.warn.replaceAll(/from[ \r\n]+<cwd>/g, "from <cwd>"))
.toMatchInlineSnapshot(`
"▲ [WARNING] It looks like you have used Wrangler v1's \`config\` command to login with an API token

"
`);
from <cwd>/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(`""`);
});

Expand Down
11 changes: 8 additions & 3 deletions packages/wrangler/src/__tests__/whoami.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<cwd>` 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 `<cwd>` in the snapshot.
expect(std.warn.replaceAll(/from[ \r\n]+<cwd>/g, "from <cwd>"))
.toMatchInlineSnapshot(`
"▲ [WARNING] It looks like you have used Wrangler v1's \`config\` command to login with an API token

from <cwd>/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.
Expand Down
3 changes: 2 additions & 1 deletion packages/wrangler/src/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand Down
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.3"
undici: "7.14.0"
# Override undici-types from @types/node so that the Cloudflare SDK typings match our installed
# version of Undici
Expand Down
15 changes: 8 additions & 7 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading