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;
45
45
*
46
46
* @param options Build options
47
47
* @param config OpenNext config
48
- * @param envVars Environment variables
48
+ * @param workerEnvVars Worker Environment variables (taken from the wrangler config files)
49
49
* @returns Deployment mapping or undefined
50
50
*/
51
51
export async function getDeploymentMapping (
52
52
options : BuildOptions ,
53
53
config : OpenNextConfig ,
54
- envVars : WorkerEnvVar
54
+ workerEnvVars : WorkerEnvVar
55
55
) : Promise < Record < string , string > | undefined > {
56
56
if ( config . cloudflare ?. skewProtection ?. enabled !== true ) {
57
57
return undefined ;
58
58
}
59
59
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
+
60
65
const nextConfig = loadConfig ( path . join ( options . appBuildOutputPath , ".next" ) ) ;
61
66
const deploymentId = nextConfig . deploymentId ;
62
67
You can’t perform that action at this time.
0 commit comments