Skip to content

FEATURE(wrangler): display details when a CLI 401 an account_id is specified in the wrangler config #9358

@vicb

Description

@vicb

Describe the solution

I was trying to repro a user bug.

Creating a D1 DB failed with:

-> % pnpm wrangler d1 create test                  

 ⛅️ wrangler 4.16.0 (update available 4.16.1)
-------------------------------------------------------


✘ [ERROR] A request to the Cloudflare API (/accounts/XXX/d1/database) failed.

  Authentication error [code: 10000]


Getting User settings...
👋 You are logged in with an OAuth Token, associated with the email [email protected].
┌──────────────┬──────────────────────────────────┐
│ Account Name │ Account ID                       │
├──────────────┼──────────────────────────────────┤
│ vicb         │ YYY │
└──────────────┴──────────────────────────────────┘
🔓 Token Permissions: If scopes are missing, you may need to logout and re-login.
[...]

It tooks me quite a long time to figure out what was happening.

The root cause was that the user has configured their account_id=XXX in the wrangler config and it was overriding my own account ID (YYY).

It would be nice to add a warning when we receive an Authentication error and the configures account_id is different from the OAuth token.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions