Skip to content

Commit e19a971

Browse files
committed
fix(deploy): drop undefined build env var values before sending
Extensions can set undefined values at runtime (e.g. env?.MISSING_VAR) despite the manifest type. JSON serialization strips them, so the client side emptiness check disagreed with what the server received and the version-skew guard misfired.
1 parent 84b6702 commit e19a971

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/cli-v3/src/commands/deploy.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,8 +1201,14 @@ async function handleNativeBuildServerDeploy({
12011201

12021202
// The build-arg values (scrubbed from build.json) travel via the deployment
12031203
// record (sent with the init request, stored encrypted server-side) — never
1204-
// as a file in the bundle. Pre-check the limits the server enforces.
1205-
bundleBuildEnvVars = buildManifest.build.env ?? {};
1204+
// as a file in the bundle. Despite the manifest type, extensions can set
1205+
// undefined values at runtime (e.g. env?.MISSING_VAR) — drop those, they'd
1206+
// be stripped by JSON serialization anyway. Pre-check the server's limits.
1207+
bundleBuildEnvVars = Object.fromEntries(
1208+
Object.entries(buildManifest.build.env ?? {}).filter(
1209+
(entry): entry is [string, string] => typeof entry[1] === "string"
1210+
)
1211+
);
12061212

12071213
const buildEnvVarCount = Object.keys(bundleBuildEnvVars).length;
12081214
const buildEnvVarBytes = Buffer.byteLength(JSON.stringify(bundleBuildEnvVars), "utf8");

0 commit comments

Comments
 (0)