workers-sdk
workers-sdk copied to clipboard
Rejected OAuth login promise (Wrangler callback blocked by Turnstile)
What versions & operating system are you using?
OS: Windows 11 Pro 25H2 Package Manager: pnpm 10.17.1
Command output:
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 AMD Ryzen 7 9700X 8-Core Processor
Memory: 27.37 GB / 55.61 GB
Binaries:
Node: 22.14.0 - C:\<redacted>\nodejs\node.EXE
npm: 10.9.2 - C:\<redacted>\nodejs\npm.CMD
pnpm: 10.17.1 - C:\<redacted>\pnpm.CMD
npmPackages:
wrangler: ~4.51.0 => 4.51.0
Please provide a link to a minimal reproduction
NA (will update if requested)
Describe the Bug
Both commands fail at the login step:
pnpm wrangler devpnpm wrangler login
The login link is launched in the browser, but upon clicking "Allow", the CLI throws an error:
$ pnpm wrangler login
⛅️ wrangler 4.51.0
───────────────────
Attempting to login via OAuth...
Opening a link in your default browser: https://dash.cloudflare.com/oauth2/auth?response_type=code&client_id=<redacted>...
X [ERROR] Failed to fetch auth token: 403 Forbidden <!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta name="robots" content="noindex,nofollow"><meta name="viewport" content="width=device-width,initial-scale=1"><style>*{box-sizing:border-box;margin:0;padding:0}html{line-height:1.15;-webkit-text-size-adjust:100%;color:#313131;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"}body{display:flex;flex-direction:column;height:100vh;min-height:100vh}.main-content{margin:8rem auto;padding-left:1.5rem;max-width:60rem}@media (width <= 720px){.main-content{margin-top:4rem}}.h2{line-height:2.25rem;font-size:1.5rem;font-weight:500}@media (width <= 720px){.h2{line-height:1.5rem;font-size:1.25rem}}#challenge-error-text{background-image:url("data:image/svg+xml;base64,PHN2Z...</script></body></html>
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
TypeError: Body is unusable: Body has already been read
at consumeBody (C:\<redacted>\node_modules\.pnpm\[email protected]\node_modules\wrangler\wrangler-dist\cli.js:16616:15)
at _Response.text (C:\<redacted>\node_modules\.pnpm\[email protected]\node_modules\wrangler\wrangler-dist\cli.js:16568:18)
at getJSONFromResponse (C:\<redacted>p\node_modules\.pnpm\[email protected]\node_modules\wrangler\wrangler-dist\cli.js:120490:31)
at exchangeAuthCodeForAccessToken (C:\<redacted>\node_modules\.pnpm\[email protected]\node_modules\wrangler\wrangler-dist\cli.js:120080:37)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Server.<anonymous> (C:\<redacted>\node_modules\.pnpm\[email protected]\node_modules\wrangler\wrangler-dist\cli.js:120236:30)
The 403 seems to be the Turnstile "Just a moment" page.
Switching to a different network fixes the issue.
Is it possible to avoid having to switch networks and handle such errors gracefully?
Please provide any relevant error logs
No response