What versions & operating system are you using?
wrangler 4.84.1
macos latest
Please provide a link to a minimal reproduction
see below
Describe the Bug
I see this and think something expired / invalid about my session:
➜ npx wrangler d1 list
⛅️ wrangler 4.84.1
───────────────────
✘ [ERROR] A request to the Cloudflare API (/memberships) failed.
Authentication failed (status: 400) [code: 9106]
If you think this is a bug, please open an issue at:
https://github.com/cloudflare/workers-sdk/issues/new/choose
Here's the 4xx error:
{
"code": 9106,
"message": "Missing X-Auth-Key, X-Auth-Email or Authorization headers"
}
Then I run npx wrangler login and only then realize that wrangler is using and API token I set in my env:
⛅️ wrangler 4.84.1
───────────────────
✘ [ERROR] You are logged in with an API Token. Unset the CLOUDFLARE_API_TOKEN in the environment to log in via OAuth.
I think I get why this happens (because API tokens don't currently support FGA, which I have enabled on my account? slash - work that we are in progress on for the Workers API)
But thinking more broadly about how we handle 4xx errors — should we handle more gracefully?
- suggest that the user
npx wrangler logout / npx wrangler login?
- expose earlier that an API token is being used by wrangler? and where that is coming from?
- attempt this for them?
- something else?
Thinking broadly about — how do we help humans and agents figure out what to do here, because won't be only time when there is 4xx
Please provide any relevant error logs
No response
What versions & operating system are you using?
wrangler 4.84.1
macos latest
Please provide a link to a minimal reproduction
see below
Describe the Bug
I see this and think something expired / invalid about my session:
Here's the 4xx error:
{ "code": 9106, "message": "Missing X-Auth-Key, X-Auth-Email or Authorization headers" }Then I run
npx wrangler loginand only then realize that wrangler is using and API token I set in my env:I think I get why this happens (because API tokens don't currently support FGA, which I have enabled on my account? slash - work that we are in progress on for the Workers API)
But thinking more broadly about how we handle 4xx errors — should we handle more gracefully?
npx wrangler logout/npx wrangler login?Thinking broadly about — how do we help humans and agents figure out what to do here, because won't be only time when there is 4xx
Please provide any relevant error logs
No response