cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.63k stars 692 forks source link

🐛 BUG: Unable to login on vm (remote machine) #6869

Open xcaeser opened 2 weeks ago

xcaeser commented 2 weeks ago

Which Cloudflare product(s) does this pertain to?

Wrangler

What version(s) of the tool(s) are you using?

3.78.12

What version of Node are you using?

22.8.0

What operating system and version are you using?

Linux Ubuntu, no gui

Describe the Bug

Login issues on a hetzner machine. Ray ID: 8cbbe31a290a9b5b

used wrangler login, npx wrangler login, pnpm wrangler login.. used inside VS Code terminal.

Also tried wrangler login --browser false. nothing.

wrangler 3.78.12
--------------------

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%20pipelines%3Awrite%20offline_access&state=j1mrQozsr4Az08Phs9Lht8yZXgqIA7mp&code_challenge=L5qKz2fuT3PBn6WPWRJ8G8pwrmfld4gPN0xlVhY7KaE&code_challenge_method=S256
▲ [WARNING] Failed to open

✘ [ERROR] The body of the response was HTML rather than JSON. Check the debug logs to see the full body of the response.

✘ [ERROR] It looks like you might have hit a bot challenge page. This may be transient but if not, please contact Cloudflare to find out what can be done. When you contact Cloudflare, please provide your Ray ID: 8cbbe31a290a9b5b-FRA

/tmp/bunx-1000-wrangler@latest/node_modules/wrangler/wrangler-dist/cli.js:29768
            throw a;
            ^

Error: Invalid JSON in response: status: 403 Forbidden
    at getJSONFromResponse (/tmp/bunx-1000-wrangler@latest/node_modules/wrangler/wrangler-dist/cli.js:159527:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async exchangeAuthCodeForAccessToken (/tmp/bunx-1000-wrangler@latest/node_modules/wrangler/wrangler-dist/cli.js:159145:31)
    at async Server.<anonymous> (/tmp/bunx-1000-wrangler@latest/node_modules/wrangler/wrangler-dist/cli.js:159313:30) {
  [cause]: SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
      at JSON.parse (<anonymous>)
      at getJSONFromResponse (/tmp/bunx-1000-wrangler@latest/node_modules/wrangler/wrangler-dist/cli.js:159514:17)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async exchangeAuthCodeForAccessToken (/tmp/bunx-1000-wrangler@latest/node_modules/wrangler/wrangler-dist/cli.js:159145:31)
      at async Server.<anonymous> (/tmp/bunx-1000-wrangler@latest/node_modules/wrangler/wrangler-dist/cli.js:159313:30)
}

Node.js v22.8.0

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

emily-shen commented 1 week ago

Hi, have you tried passing in your API token and account id with wrangler login? Something like CLOUDFLARE_ACCOUNT_ID=your-account-id CLOUDFLARE_API_TOKEN =your-api-token pnpm wrangler login

There are instructions at the start of this page for how to get those bits of info.