refactor(core,cli,webapp): drop the build env vars stored ack

An older server without build env var support fails the build on the
server side with a clear error, so the client-side ack guard, the
courtesy cancel, and the client-side limit pre-checks are unnecessary.
This commit is contained in:
Saadi Myftija
2026-08-21 16:59:46 +02:00
parent 140e4b3d30
commit 4a1ebb1725
5 changed files with 0 additions and 68 deletions
@@ -60,7 +60,6 @@ export async function action({ request, params }: ActionFunctionArgs) {
.externalBuildData as InitializeDeploymentResponseBody["externalBuildData"],
eventStream: result.eventStream,
canceledDeployments: result.canceledDeployments,
...(result.buildEnvVarsStored ? { buildEnvVarsStored: true } : {}),
}
: { isPromoted: result.isPromoted }),
};
@@ -45,7 +45,6 @@ export type InitializeDeploymentResult =
imageRef: string;
eventStream?: DeploymentEventStream;
canceledDeployments?: SupersededDeployment[];
buildEnvVarsStored?: boolean;
}
| {
outcome: "existing";
@@ -105,7 +104,6 @@ export class InitializeDeploymentService extends BaseService {
outcome: "created",
deployment: existingDeployment,
imageRef: existingDeployment.imageReference ?? "",
buildEnvVarsStored: false,
};
}
@@ -445,7 +443,6 @@ export class InitializeDeploymentService extends BaseService {
imageRef: deployment.imageReference ?? "",
eventStream,
canceledDeployments,
buildEnvVarsStored: encryptedBuildEnvVars !== undefined,
};
});
}
-13
View File
@@ -690,19 +690,6 @@ export class CliApiClient {
);
}
// 204 on success, no body
async cancelDeployment(deploymentId: string, reason?: string) {
if (!this.accessToken) {
throw new Error("cancelDeployment: No access token");
}
return fetch(`${this.apiURL}/api/v1/deployments/${deploymentId}/cancel`, {
method: "POST",
headers: this.getHeaders(),
body: JSON.stringify({ reason }),
});
}
async getDeploymentBuildEnvVars(deploymentId: string) {
if (!this.accessToken) {
throw new Error("getDeploymentBuildEnvVars: No access token");
-49
View File
@@ -105,10 +105,6 @@ type DeployCommandOptions = z.infer<typeof DeployCommandOptions>;
type Deployment = InitializeDeploymentResponseBody;
// Pre-checks of the server-enforced limits, to fail before uploading anything
const BUILD_ENV_VARS_MAX_BYTES = 128 * 1024;
const BUILD_ENV_VARS_MAX_KEYS = 200;
export function configureDeployCommand(program: Command) {
return (
commonOptions(
@@ -1364,21 +1360,6 @@ async function handleNativeBuildServerDeploy({
)
);
const buildEnvVarCount = Object.keys(bundleBuildEnvVars).length;
const buildEnvVarBytes = Buffer.byteLength(JSON.stringify(bundleBuildEnvVars), "utf8");
if (buildEnvVarCount > BUILD_ENV_VARS_MAX_KEYS) {
throw new Error(
`Your build uses too many build environment variables: ${buildEnvVarCount} (max ${BUILD_ENV_VARS_MAX_KEYS}).`
);
}
if (buildEnvVarBytes > BUILD_ENV_VARS_MAX_BYTES) {
throw new Error(
`Your build environment variables are too large: ${buildEnvVarBytes} bytes (max ${BUILD_ENV_VARS_MAX_BYTES}). Reduce the size of the env var values used by your build.`
);
}
if (options.dryRun) {
logger.info(`Dry run complete. View the built bundle at ${destination.path}`);
return;
@@ -1567,36 +1548,6 @@ async function handleNativeBuildServerDeploy({
return;
}
// No ack for sent build env vars means an older server stripped them; fail fast.
// After the outcome=existing return: a reused deployment builds nothing.
if (
options.localBundle &&
bundleBuildEnvVars &&
Object.keys(bundleBuildEnvVars).length > 0 &&
!deployment.buildEnvVarsStored
) {
// Best-effort cancel so the deployment does not linger until the queue timeout
const [cancelError] = await tryCatch(
apiClient.cancelDeployment(deployment.id, "Build environment variables were not stored")
);
if (cancelError) {
logger.debug("Failed to cancel deployment after missing build env vars ack", {
deploymentId: deployment.id,
error: cancelError,
});
}
$deploymentSpinner.stop("Failed to initialize deployment");
log.error(
chalk.bold(
chalkError(
"This server does not support --local-bundle deploys with build environment variables yet. Deploy without --local-bundle instead."
)
)
);
throw new OutroCommandError(`Deployment failed`);
}
const exposedDeploymentLink = isLinksSupported
? cliLink(chalk.bold(rawDeploymentLink), rawDeploymentLink)
: chalk.bold(rawDeploymentLink);
-2
View File
@@ -758,8 +758,6 @@ export const InitializeDeploymentResponseBody = z.object({
}),
})
.optional(),
// Ack that buildEnvVars were stored; absence on an older server is a client-side hard error
buildEnvVarsStored: z.boolean().optional(),
});
export type InitializeDeploymentResponseBody = z.infer<typeof InitializeDeploymentResponseBody>;