Skip to content

[create-cloudflare] Respect CLOUDFLARE_ACCOUNT_ID environment variable#12454

Open
petebacondarwin wants to merge 2 commits intomainfrom
pbd/wrangler/process-env-passing
Open

[create-cloudflare] Respect CLOUDFLARE_ACCOUNT_ID environment variable#12454
petebacondarwin wants to merge 2 commits intomainfrom
pbd/wrangler/process-env-passing

Conversation

@petebacondarwin
Copy link
Contributor

@petebacondarwin petebacondarwin commented Feb 6, 2026

Fixes #[no related issue].

When running wrangler init (which delegates to C3), if CLOUDFLARE_ACCOUNT_ID is set in the environment, C3 now uses it directly instead of calling wrangler whoami and prompting for account selection.

This matches wrangler's own behavior for the CLOUDFLARE_ACCOUNT_ID environment variable and enables seamless CI/CD workflows where the account is pre-configured.

Summary

  • Added check for CLOUDFLARE_ACCOUNT_ID at the start of chooseAccount() in C3
  • When set, displays status message and uses that account ID directly
  • Skips the wrangler whoami API call and account selection prompt

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: This aligns C3 behavior with existing wrangler behavior which is already documented

Open with Devin

@petebacondarwin petebacondarwin requested a review from a team as a code owner February 6, 2026 18:24
@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2026

🦋 Changeset detected

Latest commit: cf4db23

The changes in this PR will be included in the next version bump.

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

@claude
Copy link
Contributor

claude bot commented Feb 6, 2026

Claude finished @petebacondarwin's task —— View job


Changeset Review

✅ All changesets look good

The changeset .changeset/c3-respect-cloudflare-account-id-env.md follows all guidelines:

  • Version Type: Correctly marked as minor (new behavior/feature)
  • Changelog Quality: Clear, descriptive title and helpful body explaining the change and its benefit
  • Markdown Headers: No h1/h2/h3 headers used ✓
  • Format: Follows the recommended structure with good before/after context

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 6, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12454

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12454

miniflare

npm i https://pkg.pr.new/miniflare@12454

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12454

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12454

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12454

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12454

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12454

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@12454

wrangler

npm i https://pkg.pr.new/wrangler@12454

commit: cf4db23

@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Feb 7, 2026
petebacondarwin and others added 2 commits February 7, 2026 12:17
…riable

When CLOUDFLARE_ACCOUNT_ID is set in the environment, C3 now uses it
directly instead of calling wrangler whoami and prompting for account
selection. This matches wrangler's behavior and enables seamless CI/CD
workflows.
Co-authored-by: Ben <4991309+NuroDev@users.noreply.github.com>
@petebacondarwin petebacondarwin force-pushed the pbd/wrangler/process-env-passing branch from 966464e to cf4db23 Compare February 7, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Approved

Development

Successfully merging this pull request may close these issues.

2 participants