Skip to content

Commit 03f3cf0

Browse files
committed
fix(cli): honor --dry-run with --from-bundle and guard bundle artifact type
Review feedback: - --from-bundle now exits after validating the bundle manifest when --dry-run is set, before any server calls, matching the other deploy paths - --local-bundle hard-errors when the created artifact key lacks the bundle-specific prefix, catching older servers that silently store the upload as a plain source context even when no build env vars are sent
1 parent bf9b894 commit 03f3cf0

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,23 @@ async function handleNativeBuildServerDeploy({
14671467

14681468
logger.debug("Artifact created", { artifactKey });
14691469

1470+
// Version-skew guard: an older server that does not know the deployment_bundle
1471+
// artifact type silently stores the upload as a plain source context, and the
1472+
// remote build would then try to install and bundle an already-bundled directory.
1473+
// The bundle-specific key prefix doubles as the ack that the server understood
1474+
// the type, independent of whether any build env vars are sent later.
1475+
if (options.localBundle && !artifactKey.startsWith("bundles/")) {
1476+
$deploymentSpinner.stop("Failed creating deployment artifact");
1477+
log.error(
1478+
chalk.bold(
1479+
chalkError(
1480+
"This server does not support --local-bundle deploys yet. Deploy without --local-bundle instead."
1481+
)
1482+
)
1483+
);
1484+
throw new OutroCommandError(`Deployment failed`);
1485+
}
1486+
14701487
$deploymentSpinner.message("Uploading deployment files");
14711488

14721489
const [readError, fileBuffer] = await tryCatch(readFile(archivePath));
@@ -1958,6 +1975,13 @@ async function handleFromBundleDeploy({
19581975

19591976
const bundleManifest = manifestResult.data;
19601977

1978+
// Match the other deploy paths' promise: --dry-run never touches the server.
1979+
// Exit after the manifest is validated, before any branch/deployment calls.
1980+
if (options.dryRun) {
1981+
logger.info(`Dry run complete. Validated bundle at ${bundlePath}`);
1982+
return;
1983+
}
1984+
19611985
const projectRef = projectRefOverride ?? bundleManifest.config.project;
19621986

19631987
const branch = options.env === "preview" ? getBranch({ specified: options.branch }) : undefined;

0 commit comments

Comments
 (0)