Skip to content

fix: pass Cloudflare accountId to wrangler pages deploy#449

Merged
jaredwray merged 2 commits into
mainfrom
claude/intelligent-johnson-u3rcv1
Jun 19, 2026
Merged

fix: pass Cloudflare accountId to wrangler pages deploy#449
jaredwray merged 2 commits into
mainfrom
claude/intelligent-johnson-u3rcv1

Conversation

@jaredwray

Copy link
Copy Markdown
Owner

Background

Follow-up to #447. That PR fixed the pnpm build-scripts error (ERR_PNPM_IGNORED_BUILDS for sharp/workerd), which let the deploy-site workflow get past the wrangler install step for the first time. It now reaches the actual deploy command — and fails there:

🚀 Running Wrangler Commands
Error: The process '.../pnpm' failed with exit code 1
Error: 🚨 Action failed

(wrangler --version4.100.0 succeeds; the failure is the pages deploy invocation.)

Root cause

The deploy authenticates with only an API token and no account ID:

with:
  apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
  command: pages deploy site/dist --project-name=docula --branch=main

When a Cloudflare API token can access more than one account, wrangler cannot 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-action Pages setup:

with:
  apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
  accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
  command: pages deploy site/dist --project-name=docula --branch=main

⚠️ Action required

This needs a CLOUDFLARE_ACCOUNT_ID repository secret (Settings → Secrets and variables → Actions). The account ID is on the right-hand sidebar of the Cloudflare dashboard, or via wrangler 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 docula Pages project not existing on that account — in which case the wrangler error line just above Error: The process... will say so.

Notes / scope

  • I intentionally did not wire up the action's gitHubToken input. It makes the action create GitHub Deployment records, which requires deployments: write permission 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.
  • No wrangler.toml/wrangler.jsonc exists 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

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
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (97bae99) to head (8a5e57e).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jaredwray jaredwray changed the title Fix deploy: pass Cloudflare accountId to wrangler pages deploy fix: pass Cloudflare accountId to wrangler pages deploy Jun 19, 2026
@jaredwray jaredwray merged commit e8dfe42 into main Jun 19, 2026
11 checks passed
@jaredwray jaredwray deleted the claude/intelligent-johnson-u3rcv1 branch June 19, 2026 21:17
@jaredwray jaredwray mentioned this pull request Jul 8, 2026
4 tasks
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.

2 participants