File tree Expand file tree Collapse file tree 3 files changed +9
-8
lines changed
packages/cloudflare/src/cli/commands Expand file tree Collapse file tree 3 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,11 @@ export async function deployCommand(args: WithWranglerArgs<{ cacheChunkSize: num
2727
2828 const wranglerConfig = readWranglerConfig ( args ) ;
2929
30- const platformProxyEnvVars = await getEnvFromPlatformProxy ( {
30+ const envVars = await getEnvFromPlatformProxy ( {
3131 configPath : args . configPath ,
3232 environment : args . env ,
3333 } ) ;
3434
35- const envVars = { ...platformProxyEnvVars , ...process . env } ;
36-
3735 const deploymentMapping = await getDeploymentMapping ( options , config , envVars ) ;
3836
3937 await populateCache ( options , config , wranglerConfig , {
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
Original file line number Diff line number Diff line change @@ -27,13 +27,11 @@ export async function uploadCommand(args: WithWranglerArgs<{ cacheChunkSize: num
2727
2828 const wranglerConfig = readWranglerConfig ( args ) ;
2929
30- const platformProxyEnvVars = await getEnvFromPlatformProxy ( {
30+ const envVars = await getEnvFromPlatformProxy ( {
3131 configPath : args . configPath ,
3232 environment : args . env ,
3333 } ) ;
3434
35- const envVars = { ...platformProxyEnvVars , ...process . env } ;
36-
3735 const deploymentMapping = await getDeploymentMapping ( options , config , envVars ) ;
3836
3937 await populateCache ( options , config , wranglerConfig , {
You can’t perform that action at this time.
0 commit comments