Azure / Azure/static-web-apps-cli

swa deploy exits 0 without uploading files — StaticSitesClient receives unrecognized --environment flag

オープン
#998 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
668
フォーク
156
PR マージ指標
30日以内にマージされた PR はありません

説明

## Describe the bug

`swa deploy ./dist --deployment-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 --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

1. Have a built static site in `./dist`
2. Run: `swa deploy ./dist --deployment-token --env default`
3. Observe output stops at "Preparing deployment. Please wait..."
4. No "Deployment Complete" message, no upload progress
5. Exit code is 0
6. 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:

```bash
StaticSitesClient --deploymentaction upload \
--app "dist" \
--appArtifactLocation "." \
--apiToken \
--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

- #783 (CLI doesn't produce a failure exit code in case of failure)
- #914 (SWA obscures underlying errors reported by StaticSitesClient)

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

StaticSitesClient を呼び出す SWA CLI の deploy エントリーポイントから始め、`--environment` 引数を探します。ここで説明されている `--environmentName` の動作と比較します。`swa deploy ./dist --deployment-token --env default` で再現し、その後、デプロイによってファイルがアップロードされ、完了が報告され、認識されないフラグの場合が成功として扱われないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
azure, typescript
領域
cli, cloud
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
68/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。