Skip to content

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Oct 9, 2025

We used to only consider variables from the Worker env, missing variables from process.env and .env* files for the CLI.

This is ok to retrieve public values (i.e. R2_CACHE_PREFIX_ENV_NAME) but makes it hard to pass secrets (i.e. CF_ACCOUNT_ID) to the CI.

This PR take all of process.env, wrangler config, and .env* files into account when retrieving the variables.

Notes:

  • we now pass envFiles: [] to getPlatformProxy() to avoid having wrangler handling the .env* files as it doesn't match what Next does
  • there are some code refactoring (shuffling code in the populate-cache.ts, options & buildOptions --> buildOpts) that I should probably have done in a follow up PR, sorry for the churn here.

@james-elicx could you please take a look when you have time?

Copy link

changeset-bot bot commented Oct 9, 2025

🦋 Changeset detected

Latest commit: 7574c4b

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

This PR includes changesets to release 1 package
Name Type
@opennextjs/cloudflare Minor

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

@vicb vicb requested a review from james-elicx October 9, 2025 08:48
Copy link

pkg-pr-new bot commented Oct 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@opennextjs/cloudflare@937

commit: 7574c4b

Copy link
Collaborator

@james-elicx james-elicx left a comment

Choose a reason for hiding this comment

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

Looks good :)

vicb and others added 2 commits October 10, 2025 08:36
@vicb
Copy link
Contributor Author

vicb commented Oct 10, 2025

Thanks James for the review and fixes!

@vicb vicb merged commit 32ba91a into main Oct 10, 2025
7 checks passed
@vicb vicb deleted the vic/cli-envvars branch October 10, 2025 06:56
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