Skip to content

Commit 585795d

Browse files
fix: regression where getEnvFromPlatformProxy received wrong options type (#1206)
* fix: regression where getEnvFromPlatformProxy received wrong options type This fixes a regression introduced in 32ba91a where `getEnvFromPlatformProxy` call sites passed `OpenNextConfig` even though the function expects Wrangler `GetPlatformProxyOptions`. The fix restores the pre-32ba91a argument shape by passing `{ configPath, environment }` from CLI arguments, so env resolution follows the selected Wrangler config/environment. It also adds explicit return type annotations to related CLI helpers to make declaration output stable and not rely on inference. * undo unrelated type changes * Apply suggestion from @james-elicx --------- Co-authored-by: James <james@eli.cx>
1 parent 6f02d12 commit 585795d

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

.changeset/red-yaks-go.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
fix: regression where getEnvFromPlatformProxy received wrong options type
6+
7+
This fixes a regression introduced in [32ba91a](https://github.com/opennextjs/opennextjs-cloudflare/commit/32ba91a6d3fa6b9a8b2cd5a8c973c3b3eb1108f0) where `getEnvFromPlatformProxy` call sites passed `OpenNextConfig` even though the function expects Wrangler `GetPlatformProxyOptions`.
8+
9+
The fix restores the pre-[32ba91a](https://github.com/opennextjs/opennextjs-cloudflare/commit/32ba91a6d3fa6b9a8b2cd5a8c973c3b3eb1108f0) argument shape by passing `{ configPath, environment }` from CLI arguments, so env resolution follows the selected Wrangler config/environment.

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ export async function deployCommand(args: WithWranglerArgs<{ cacheChunkSize?: nu
2828

2929
const wranglerConfig = await readWranglerConfig(args);
3030

31-
const envVars = await getEnvFromPlatformProxy(config, buildOpts);
31+
const envVars = await getEnvFromPlatformProxy(
32+
{
33+
configPath: args.wranglerConfigPath,
34+
environment: args.env,
35+
},
36+
buildOpts
37+
);
3238

3339
await populateCache(
3440
buildOpts,

packages/cloudflare/src/cli/commands/populate-cache.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,13 @@ async function populateCacheCommand(
7171
const buildOpts = getNormalizedOptions(config);
7272

7373
const wranglerConfig = await readWranglerConfig(args);
74-
const envVars = await getEnvFromPlatformProxy(config, buildOpts);
74+
const envVars = await getEnvFromPlatformProxy(
75+
{
76+
configPath: args.wranglerConfigPath,
77+
environment: args.env,
78+
},
79+
buildOpts
80+
);
7581

7682
await populateCache(
7783
buildOpts,

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@ export async function previewCommand(
2727
const buildOpts = getNormalizedOptions(config);
2828

2929
const wranglerConfig = await readWranglerConfig(args);
30-
const envVars = await getEnvFromPlatformProxy(config, buildOpts);
30+
const envVars = await getEnvFromPlatformProxy(
31+
{
32+
configPath: args.wranglerConfigPath,
33+
environment: args.env,
34+
},
35+
buildOpts
36+
);
3137

3238
await populateCache(
3339
buildOpts,

0 commit comments

Comments
 (0)