fix: add CLOUDFLARE_ACCOUNT_ID to deploy workflow#158
Merged
Conversation
Wrangler calls the /memberships API to discover the account, which requires User Memberships Read permission. Adding CLOUDFLARE_ACCOUNT_ID skips this lookup entirely. Also update README to recommend the 'Edit Cloudflare Workers' template and document both required secrets.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the production deployment pipeline to pass Cloudflare’s account ID explicitly to Wrangler, avoiding a failing account-discovery API call, and updates the README to document the additional required secret.
Changes:
- Add
CLOUDFLARE_ACCOUNT_IDto the deploy workflow steps that run Wrangler (migrations + deploy). - Update README CI/CD docs to require both
CLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_ID, and recommend a Cloudflare API token template/permissions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| README.md | Documents the two required GitHub secrets for deploy and recommends the appropriate Cloudflare API token setup. |
| .github/workflows/deploy.yml | Passes CLOUDFLARE_ACCOUNT_ID to Wrangler-invoking steps to prevent failing account lookup. |
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.
Summary
CLOUDFLARE_ACCOUNT_IDenv var to the deploy job steps so Wrangler skips the/membershipsAPI call that was failing with authentication errorCLOUDFLARE_API_TOKENandCLOUDFLARE_ACCOUNT_ID)Root Cause
Wrangler calls the Cloudflare
/membershipsAPI to discover the account to deploy to. This requires the User Memberships Read permission. PassingCLOUDFLARE_ACCOUNT_IDas an environment variable bypasses this lookup entirely — which is the approach recommended by Cloudflare's GitHub Actions deployment docs.