File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
packages/cloudflare/src/cli/commands Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @opennextjs/cloudflare " : patch
3+ ---
4+
5+ fix ` deploy ` and ` upload ` commands not taking into account environment variables
Original file line number Diff line number Diff line change @@ -45,18 +45,23 @@ const MS_PER_DAY = 24 * 3600 * 1000;
4545 *
4646 * @param options Build options
4747 * @param config OpenNext config
48- * @param envVars Environment variables
48+ * @param workerEnvVars Worker Environment variables (taken from the wrangler config files)
4949 * @returns Deployment mapping or undefined
5050 */
5151export async function getDeploymentMapping (
5252 options : BuildOptions ,
5353 config : OpenNextConfig ,
54- envVars : WorkerEnvVar
54+ workerEnvVars : WorkerEnvVar
5555) : Promise < Record < string , string > | undefined > {
5656 if ( config . cloudflare ?. skewProtection ?. enabled !== true ) {
5757 return undefined ;
5858 }
5959
60+ // Note that `process.env` is spread after `workerEnvVars` since we do want
61+ // system environment variables to take precedence over the variables defined
62+ // in the wrangler config files
63+ const envVars = { ...workerEnvVars , ...process . env } ;
64+
6065 const nextConfig = loadConfig ( path . join ( options . appBuildOutputPath , ".next" ) ) ;
6166 const deploymentId = nextConfig . deploymentId ;
6267
You can’t perform that action at this time.
0 commit comments