Skip to content

fix(platform): name the failing credential in deploy, repair and upgrade errors - #887

Open
Brooooooklyn wants to merge 15 commits into
mainfrom
fix/platform-credential-errors
Open

Brooooooklyn wants to merge 15 commits into
mainfrom
fix/platform-credential-errors

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Answers operator feedback: platform deploys stopped after an upgrade because of bad credentials, and no error said which credential failed.

What changes for the operator

deploy upload gets R2 403/400 ──► "R2 rejected the upload signature (<code>) … platform's R2
                                   upload credentials … If you run this platform: set
                                   VOID_PLATFORM_R2_* and run `void platform repair`"

repair / upgrade
  ├─ R2 pair from env ──► signed ListObjectsV2 on the assets bucket, BEFORE anything changes
  │                        bad pair → stop, status stays `installed` (was: success + broken deploys)
  │                        clock skew / network / 5xx → warn and continue
  ├─ only one VOID_PLATFORM_R2_* set ──► stop: "set both, even if only the secret changed"
  ├─ any Cloudflare 401/403 ──► names the token + where it came from
  │      (CLOUDFLARE_API_TOKEN / CF_API_TOKEN / saved / entered / browser login /
  │       runtime from env / runtime saved), 401 vs 403 advice differ
  ├─ AI Gateway under browser login ──► says Void used the runtime token for it, and how to fix
  └─ missing permissions ──► all listed in one error (was: one per run)

after Worker activation
  └─ empty list or an older known deployment at the head ──► wait and re-read (same budget)
     unknown head ──► still "changed concurrently after activation"

Feedback → result

Feedback Result
Raw R2 XML on deploy Fixed: credential codes mapped to a hedged message aimed at the operator; raw body kept in the log
Repair accepted an R2 pair that can't sign Fixed: signed check before any change, and the two halves must be set together
401 didn't name the token Fixed: every 401/403 from the platform client names the credential and its source
Missing permissions one per run Fixed for the read checks: all denials in one error
"changed concurrently after activation" with no other deploy The main case was already fixed in v1.11.0 (#868); this hardens the empty-list / stale-head case
void platform credentials check command Not added: the same checks now run, all-at-once, before repair/upgrade change anything
Docs: R2 pair from an API token Added (token id / SHA-256 of the token value). The "editing from the R2 page strips permissions" warning is not in Cloudflare's docs, so it's left out

Known limits

  • Reads can't prove Edit rights. A token with Read but not Edit (KV write for the traffic pause, route publish, Worker upload) can still fail after the run starts. That error now names the credential.
  • The R2 check lists objects, so a read-only R2 token passes it and then fails on upload (that error is now mapped).
  • repair --plan / upgrade --plan do not run the runtime-token or R2 checks.

Verification

  • vp check: clean
  • vp test run: 840 files passed (18,101 tests)
  • The SigV4 signer is pinned with a test vector cross-checked against aws4fetch 1.0.20

🤖 Generated with Claude Code

Brooooooklyn and others added 15 commits November 20, 2026 21:45
… missing permission

Each operator and runtime client now knows which credential it holds and
where it came from. A 401 or 403 answer names it, keeps the same error
class, status and path, and says what to do: replace a token Cloudflare
did not accept, or add the missing permission.

Under browser login the AI Gateway client says it used the runtime token
(from the variable or saved on this machine), so the fix is the runtime
token. Without a runtime token it says browser login cannot use AI Gateway.

The operator check and the runtime-token preflight run every check and
throw one error that lists each denied permission. The email-only error
class stays, so install still keeps a token that only lacks email access.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plan reads Cloudflare inventory in parallel. Collect each 401 or 403
answer and group it by credential, next to any missing account
prerequisite, instead of surfacing the first raw error. One denial is
still thrown as it is, and the first denial stays the cause.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After activation, a read that comes back empty, or that has an older
deployment we already listed at its head, now waits and reads again
within the same budget, the same as a head that still shows the
previous deployment. If it stays stale, the deploy ends with "could not
confirm activation" and leaves the cutover for recovery. A head with an
unknown id still fails as "changed concurrently after activation".

A new Worker whose list is empty right after creation waits the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…signature

Parse the S3 <Code> from the R2 error body. For 401/403 with Unauthorized,
AccessDenied, SignatureDoesNotMatch or InvalidAccessKeyId, say the platform's
R2 upload credentials are likely wrong and give operator steps. Other codes
keep the raw response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting only one VOID_PLATFORM_R2_* value replaced half of the live pair and
left the Workers signing with a mismatched pair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One SigV4-signed ListObjectsV2 against the assets bucket. A rejected
signature fails with the source of the pair and the steps to fix it; a
network error or R2 outage only warns.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the platform

When the run sends an R2 key pair to the Workers (from VOID_PLATFORM_R2_*,
or the saved pair for a new api Worker), sign one request to the assets
bucket first. A rejected pair stops the command before traffic pauses, so
the installation is not left marked failed. A bucket this run creates is
not checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on repair

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he R2 key pair check

Stop only on the credential codes the upload mapping uses (or a bare
401/403), warn with a clock hint on RequestTimeTooSkewed, and treat R2's
400 InvalidArgument / AuthorizationHeaderMalformed answer to a wrong-length
Access Key ID as a rejected pair, in the check and in the upload error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent token for AI Gateway

Drop "Wrangler" from the browser login label, which the CLI rewrites in
printed errors. Under browser login, a management token in
CLOUDFLARE_API_TOKEN with AI Gateway access also fixes an AI Gateway
error, so say so in the error and the maintenance guide.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…p it after a later failure

Raw-fetch client methods (KV value, R2 objects, deletes) and the
workers.dev subdomain read now name the rejected credential. When a token
check is denied and a later check fails for another reason, report the
denial so install still clears and asks again for a rejected saved token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… print each denial once

Label the management token pasted or saved during browser-login setup so
its denials say which token Cloudflare rejected, and skip a cause in the
retry warning when an earlier message already contains it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The management-token retry warning walked the cause chain and printed the
first denied read again under the combined list, because a labeled list
never contains the raw message. Skip any cause the AggregateError above it
already lists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T14:16:03.062595Z 2c825bf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-platform-credential-errors-void-cloud.voidzero-docs.workers.dev (commit 2c825bf)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://6fa4658d-void-cloud.voidzero-docs.workers.dev 2c825bf 2026-11-20T14:15:20.246Z Visit the dashboard ↗

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant