[wrangler] Explain authentication required by remote bindings - #14806
Conversation
🦋 Changeset detectedLatest commit: dced430 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
Nice fix for the messaging! One gap I found while digging into #14798 that this PR doesn't cover yet: the I ran a curl matrix directly against
The reason this matters for the reported bug specifically: So even with this PR's improved copy, a user with a stale/revoked token would still see the raw, unexplained Suggest widening the switch to also catch case 9106:
case 10000:
case 10405: {
throw new RemoteSessionAuthenticationError(error);
}Happy to share the repro workflow (live curl matrix + a small unit test suite covering this) if useful. |
9910b05 to
ab4ffff
Compare
|
Great catch @allocsys! I’ve added 10405 to the remote-session authentication cases and covered it with an API error using HTTP 405. I kept the change scoped to remote-binding session errors rather than widening Wrangler’s global authentication classifier. The remote-bindings tests and repository checks pass. |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
@cloudflare/autoconfig
@cloudflare/config
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
Fixes #14798.
When local development starts bindings that need to run remotely, Wrangler now explains why Cloudflare authentication is required before showing the existing API token or OAuth recovery guidance.
It also maps the
edge-previewAPI's10405response into the same friendly remote-session authentication error. This preserves the original error cause, telemetry message, and remediation steps. Tests cover all three observed API authentication codes and snapshot the API token and OAuth messages.Risk: error-handling/message-only. No authentication or remote-binding behavior changes.
Validation:
pnpm -w test:ci -F @cloudflare/remote-bindings— 5 files and 18 tests passedpnpm check— 197 tasks passed, including build, lint, formatting, typechecks, and type testspnpm changeset status --since=upstream/main— Wrangler patch changeset detected