Skip to content

Commit b334fcd

Browse files
committed
fix(cli): correct the artifact guard comment and skip-sync notice condition
Older servers reject the bundle artifact type outright, so the prefix guard is defense in depth rather than primary detection; the skip-sync notice now considers secret and parent vars like the classic path.
1 parent 0706c79 commit b334fcd

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,18 +1776,18 @@ async function handleLocalBundleDeploy({
17761776
}
17771777

17781778
// Sync BEFORE init: init enqueues the build synchronously, so a post-init sync races a fast build
1779-
if (!options.skipSyncEnvVars) {
1780-
const childVars = buildManifest.deploy.sync?.env ?? {};
1781-
const parentVars = buildManifest.deploy.sync?.parentEnv ?? {};
1782-
const secretChildVars = buildManifest.deploy.sync?.secretEnv ?? {};
1783-
const secretParentVars = buildManifest.deploy.sync?.secretParentEnv ?? {};
1779+
const childVars = buildManifest.deploy.sync?.env ?? {};
1780+
const parentVars = buildManifest.deploy.sync?.parentEnv ?? {};
1781+
const secretChildVars = buildManifest.deploy.sync?.secretEnv ?? {};
1782+
const secretParentVars = buildManifest.deploy.sync?.secretParentEnv ?? {};
17841783

1785-
const hasVarsToSync =
1786-
Object.keys(childVars).length > 0 ||
1787-
Object.keys(secretChildVars).length > 0 ||
1788-
// Only sync parent variables if this is a branch environment
1789-
(branch && (Object.keys(parentVars).length > 0 || Object.keys(secretParentVars).length > 0));
1784+
const hasVarsToSync =
1785+
Object.keys(childVars).length > 0 ||
1786+
Object.keys(secretChildVars).length > 0 ||
1787+
// Only sync parent variables if this is a branch environment
1788+
(branch && (Object.keys(parentVars).length > 0 || Object.keys(secretParentVars).length > 0));
17901789

1790+
if (!options.skipSyncEnvVars) {
17911791
if (hasVarsToSync) {
17921792
const uploadResult = await syncEnvVarsWithServer(
17931793
apiClient,
@@ -1805,7 +1805,7 @@ async function handleLocalBundleDeploy({
18051805

18061806
logger.debug("Synced env vars with the server");
18071807
}
1808-
} else if (Object.keys(buildManifest.deploy.sync?.env ?? {}).length > 0) {
1808+
} else if (hasVarsToSync) {
18091809
logger.log(
18101810
"Skipping syncing env vars. The environment variables in your project have changed, but the --skip-sync-env-vars flag was provided."
18111811
);
@@ -1836,8 +1836,9 @@ async function handleLocalBundleDeploy({
18361836

18371837
logger.debug("Artifact created", { artifactKey });
18381838

1839-
// The bundle key prefix is the ack that the server understood the deployment_bundle
1840-
// type; an older server silently stores the upload as a plain source context.
1839+
// Defense in depth: current older servers already reject the deployment_bundle
1840+
// type at createArtifact; this catches a server that accepts it but returns a
1841+
// non-bundle key, which would make the remote build treat the bundle as source.
18411842
if (!artifactKey.startsWith("bundles/")) {
18421843
$deploymentSpinner.stop("Failed creating deployment artifact");
18431844
log.error(

0 commit comments

Comments
 (0)