Skip to content

[create-cloudflare] Respect CLOUDFLARE_ACCOUNT_ID environment variable#12454

Merged
petebacondarwin merged 2 commits intomainfrom
pbd/wrangler/process-env-passing
Feb 9, 2026
Merged

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

Conversation

@petebacondarwin
Copy link
Copy Markdown
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
Copy Markdown

changeset-bot Bot commented Feb 6, 2026

🦋 Changeset detected

Latest commit: fc829cd

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
Copy Markdown
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 has been validated against quality criteria:

  • Version Type: minor is appropriate - this adds new functionality (respecting the CLOUDFLARE_ACCOUNT_ID environment variable)
  • Changelog Quality: Clear, meaningful description with proper context about the behavior change and its benefits
  • Markdown Headers: No h1/h2/h3 headers used
  • Package Coverage: Only affects create-cloudflare, correctly specified
  • Format: Follows the recommended format with title and detailed body paragraphs

The changeset properly describes what changed, why it matters (CI/CD workflows), and provides context about previous behavior.


Copy link
Copy Markdown
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
Copy Markdown

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: fc829cd

Comment thread .changeset/c3-respect-cloudflare-account-id-env.md Outdated
Comment thread packages/create-cloudflare/src/wrangler/accounts.ts
Comment thread packages/create-cloudflare/src/wrangler/accounts.ts
@github-project-automation github-project-automation Bot moved this from Untriaged to Approved in workers-sdk Feb 7, 2026
@petebacondarwin petebacondarwin force-pushed the pbd/wrangler/process-env-passing branch from 966464e to cf4db23 Compare February 7, 2026 12:17
petebacondarwin and others added 2 commits February 9, 2026 11:58
…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 cf4db23 to fc829cd Compare February 9, 2026 11:58
@petebacondarwin petebacondarwin merged commit c99c437 into main Feb 9, 2026
35 checks passed
@petebacondarwin petebacondarwin deleted the pbd/wrangler/process-env-passing branch February 9, 2026 12:36
@github-project-automation github-project-automation Bot moved this from Approved to Done in workers-sdk Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants