Workers SDK Issue Reports

← Back to Dashboard

#10466 API request (/memberships) failed with API token

Recommendation:KEEP OPEN
Difficulty:easy
Reasoning:

Workaround: set CLOUDFLARE_ACCOUNT_ID; confusing UX with API tokens

Suggested Action:

Use /accounts endpoint or improve error message

Analysis Report

Issue Review: cloudflare/workers-sdk#10466

Summary

API token authentication fails for /memberships endpoint when deploying, even though wrangler whoami works.

Findings

  • Created: 2025-08-26
  • Updated: 2026-01-15
  • Version: wrangler 4.32.0 → 4.61.0
  • Component: wrangler (deploy)
  • Labels: bug
  • Comments: 4

Key Evidence

  • wrangler whoami works but wrangler deploy fails with code 10001
  • Error: "Unable to authenticate request" on /memberships endpoint
  • Workarounds:
    1. Set CLOUDFLARE_ACCOUNT_ID environment variable (confirmed by maintainer @petebacondarwin)
    2. Set account_id in wrangler config
    3. First deploy via OAuth, then API token works
  • Root cause: Without account_id, wrangler hits /memberships to get list of accounts

Recommendation

Status: KEEP OPEN

Reasoning: This is a valid UX issue. The workaround (setting CLOUDFLARE_ACCOUNT_ID) is simple, but the behavior is confusing. Users expect API tokens with "Edit Cloudflare Workers" to work without additional setup.

Action: Consider using /accounts endpoint (like whoami does) instead of /memberships, or improve error message to suggest setting account_id.

Suggested Comment

N/A - Workaround documented by maintainer.

Notes & Feedback (0)

No notes yet.

Add Note