Skip to content

Commit 092f5d1

Browse files
update solution to use env filed instead
1 parent 2f460ed commit 092f5d1

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

packages/cloudflare/src/cli/commands/deploy.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ export async function deployCommand(args: WithWranglerArgs<{ cacheChunkSize?: nu
5656
],
5757
{
5858
logging: "all",
59-
deploy: true,
59+
env: {
60+
// If we are running the deploy command we set this OPEN_NEXT_DEPLOY environment variable
61+
// to let `wrangler deploy` know that it is being run from open-next. We do this because
62+
// otherwise `wrangler deploy` run in an open-next project would call
63+
// `opennextjs-cloudflare deploy` (thus causing an unwanted recursion).
64+
OPEN_NEXT_DEPLOY: "true",
65+
},
6066
}
6167
);
6268
}

packages/cloudflare/src/cli/utils/run-wrangler.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type WranglerOptions = {
1313
environment?: string;
1414
configPath?: string;
1515
logging?: "all" | "error";
16-
deploy?: boolean;
16+
env?: Record<string, unknown>;
1717
};
1818

1919
/**
@@ -84,11 +84,7 @@ export function runWrangler(options: BuildOptions, args: string[], wranglerOpts:
8484
// Wrangler would load `.env.<wrangler env>` while we should load `.env.<process.env.NEXTJS_ENV>`
8585
// See https://opennext.js.org/cloudflare/howtos/env-vars
8686
CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV: "false",
87-
// If we are running the deploy command we set this OPEN_NEXT_DEPLOY environment variable
88-
// to let `wrangler deploy` know that it is being run from open-next. We do this because
89-
// otherwise `wrangler deploy` run in an open-next project would call
90-
// `opennextjs-cloudflare deploy` (thus causing an unwanted recursion).
91-
...(wranglerOpts.deploy ? { OPEN_NEXT_DEPLOY: "true" } : {}),
87+
...wranglerOpts.env,
9288
},
9389
}
9490
);

0 commit comments

Comments
 (0)