Describe the bug
swa deploy ./dist --deployment-token <TOKEN> --env default reports "Preparing deployment. Please wait..." then exits with code 0 - but no files are uploaded to the Static Web App.
Root cause (from investigation)
The SWA CLI passes --environment to the underlying StaticSitesClient binary, but that binary only recognizes --environmentName. When StaticSitesClient receives the unrecognized flag, it prints its help text to stderr and exits 0, which the CLI interprets as success.
Evidence from running StaticSitesClient directly:
StaticSitesClient --app dist --apiToken <TOKEN> --environment default --skipAppBuild true
ERROR(S):
Option 'environment' is unknown.
Exit code: 0 (not 1), so the CLI's if (exitCode !== 0) check passes.
To Reproduce
- Have a built static site in
./dist
- Run:
swa deploy ./dist --deployment-token <TOKEN> --env default
- Observe output stops at "Preparing deployment. Please wait..."
- No "Deployment Complete" message, no upload progress
- Exit code is 0
- Verify on Azure Portal or via curl that old files are still being served
Expected behavior
- Either pass the correct
--environmentName flag to StaticSitesClient
- Or detect the silent failure (no "Deployment Complete" in StaticSitesClient output) and report an error
Workaround
Call StaticSitesClient directly with the correct flags:
StaticSitesClient --deploymentaction upload \
--app "dist" \
--appArtifactLocation "." \
--apiToken <TOKEN> \
--skipAppBuild true \
--skipApiBuild true \
--deploymentProvider Custom
Environment
- SWA CLI version: 2.0.8
- Node.js: v24.12.0 (also reproduced with v20.11.0)
- OS: Windows 11
- StaticSitesClient version: 1.0.0+689a6c1fe8fc32f40348cc41223a7e9d83dd43d2
Related issues
Describe the bug
swa deploy ./dist --deployment-token <TOKEN> --env defaultreports "Preparing deployment. Please wait..." then exits with code 0 - but no files are uploaded to the Static Web App.Root cause (from investigation)
The SWA CLI passes
--environmentto the underlying StaticSitesClient binary, but that binary only recognizes--environmentName. When StaticSitesClient receives the unrecognized flag, it prints its help text to stderr and exits 0, which the CLI interprets as success.Evidence from running StaticSitesClient directly:
Exit code: 0 (not 1), so the CLI's
if (exitCode !== 0)check passes.To Reproduce
./distswa deploy ./dist --deployment-token <TOKEN> --env defaultExpected behavior
--environmentNameflag to StaticSitesClientWorkaround
Call StaticSitesClient directly with the correct flags:
Environment
Related issues