File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
packages/cloudflare/src/cli/templates Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ const cloudflareContextALS = new AsyncLocalStorage<CloudflareContext>();
2020// eslint-disable-next-line @typescript-eslint/no-explicit-any
2121( globalThis as any ) [ Symbol . for ( "__cloudflare-context__" ) ] = createALSProxy ( cloudflareContextALS ) ;
2222
23+ const originalEnv : Partial < typeof process . env > = { ...globalThis . process . env } ;
2324// @ts -expect-error - populated when we run inside the ALS context
2425globalThis . process . env = createALSProxy ( processEnvALS ) ;
2526
@@ -30,7 +31,7 @@ let requestHandler: NodeRequestHandler | null = null;
3031
3132export default {
3233 async fetch ( request , env , ctx ) {
33- return processEnvALS . run ( { NODE_ENV : "production" , ...env } , ( ) => {
34+ return processEnvALS . run ( { NODE_ENV : "production" , ...originalEnv , ... env } , ( ) => {
3435 return cloudflareContextALS . run ( { env, ctx, cf : request . cf } , async ( ) => {
3536 if ( requestHandler == null ) {
3637 // Note: "next/dist/server/next-server" is a cjs module so we have to `require` it not to confuse esbuild
You can’t perform that action at this time.
0 commit comments