fix: pass Cloudflare accountId to wrangler pages deploy#449
Merged
Conversation
With the build-scripts fix in place, the deploy now reaches the actual
`wrangler pages deploy` step, which fails with exit code 1. The command
authenticated with only an API token and no account ID. When the token
can access more than one Cloudflare account, wrangler cannot select one
in non-interactive (CI) mode and aborts.
Pass `accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}` to the
wrangler-action, matching Cloudflare's documented Pages-deploy setup.
Requires a `CLOUDFLARE_ACCOUNT_ID` repository secret to be configured.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EzqaQQ3rPk1WB5mnRFMHeZ
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #449 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 18 18
Lines 2744 2744
Branches 836 827 -9
=========================================
Hits 2744 2744 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Follow-up to #447. That PR fixed the
pnpmbuild-scripts error (ERR_PNPM_IGNORED_BUILDSforsharp/workerd), which let thedeploy-siteworkflow get past the wrangler install step for the first time. It now reaches the actual deploy command — and fails there:(
wrangler --version→4.100.0succeeds; the failure is thepages deployinvocation.)Root cause
The deploy authenticates with only an API token and no account ID:
When a Cloudflare API token can access more than one account,
wranglercannot pick one in non-interactive (CI) mode and aborts with exit 1 (No account id found, quitting..). This step was never exercised before because the install always failed first (pre-#447).Fix
Pass the account ID, matching Cloudflare's documented
wrangler-actionPages setup:This needs a
CLOUDFLARE_ACCOUNT_IDrepository secret (Settings → Secrets and variables → Actions). The account ID is on the right-hand sidebar of the Cloudflare dashboard, or viawrangler whoami.If the deploy still fails after adding the secret, the next most likely cause is the API token's permissions (it needs Account → Cloudflare Pages → Edit) or the
doculaPages project not existing on that account — in which case the wrangler error line just aboveError: The process...will say so.Notes / scope
gitHubTokeninput. It makes the action create GitHub Deployment records, which requiresdeployments: writepermission plus an extra API call — added failure surface on a deploy we're trying to get green. Happy to add it as a follow-up if you want Deployment tracking in the GitHub UI.wrangler.toml/wrangler.jsoncexists in the repo, so the account ID must come from the action input/secret (this PR) rather than config.🤖 Generated with Claude Code
Generated by Claude Code