Azure / Azure/static-web-apps-cli
Default proxy setting is not working for SWA CLI and still download metadata for StaticSitesClient from internet after downloaded & manually configured StaticSitesClient.json
- 主要言語
- TypeScript
- スター
- 668
- フォーク
- 156
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
swa --version
2.0.2
**Are you accessing the CLI from the default port `:4280` ?**
- [ ] No, I am using a different port number (`--port`) and accessing the CLI from that port
- [Yes ] Yes, I am accessing the CLI from port `:4280`
> Make sure you are accessing the URL printed in the console when running `swa start`!
```
swa start
Welcome to Azure Static Web Apps CLI (2.0.2)
***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure. *
***********************************************************************
Serving static content:
/home/aaaa
Azure Static Web Apps emulator started at http://localhost:4280. Press CTRL+C to exit.
```
**ℹ️ NOTE: Make sure to enable debug logs when running any `swa` commands using `--verbose=silly`**
Yes
**Describe the bug**
We are trying to deploy static web app from azure vm acting as azure devops agent. Thus, from azure pipeline we are running `swa deploy` command. Our vm is behind proxy,
hence when running swa cli command its not able to download StaticSitesClient directly. As per https://azure.github.io/static-web-apps-cli/docs/contribute/Troubleshooting#unable-to-download-staticsitesclient-binary-file-not-found-404---403 we have downloaded manually, kept under user home dir. as per suggested path and along with created .json file
```
pwd
/home/aaaa/.swa/deploy
total 4
drwx------. 2 aaaa domain users 31 Jan 6 11:34 53b7d0e07fe5c34bf68929fab92f87ce910288dc
-rw-------. 1 aaaa domain users 1154 Jan 6 11:59 StaticSitesClient.json
ls -l 53b7d0e07fe5c34bf68929fab92f87ce910288dc/
total 69552
-rwx------. 1 aaaa domain users 71217367 Jan 6 11:34 StaticSitesClient
cat StaticSitesClient.json
{
"metadata": {
"version": "stable",
"buildId": "53b7d0e07fe5c34bf68929fab92f87ce910288dc",
"publishDate": "2024-10-24T20:43:23.5850191Z",
"files": {
"linux-x64": {
"url": "https://swalocaldeployv2-bndtgugjgqc3dhdx.b01.azurefd.net/downloads/53b7d0e07fe5c34bf68929fab92f87ce910288dc/linux/StaticSitesClient",
"sha": "66fca4b42cbc64d451097931ca4ed75649233bd818f97f0c3f6d1d75cff61413"
},
"win-x64": {
"url": "https://swalocaldeployv2-bndtgugjgqc3dhdx.b01.azurefd.net/downloads/53b7d0e07fe5c34bf68929fab92f87ce910288dc/windows/StaticSitesClient.exe",
"sha": "fc949fb19d29cce1e8b74cf1e2c31706426d46b3e03d830d601524cee63faa0b"
},
"osx-x64": {
"url": "https://swalocaldeployv2-bndtgugjgqc3dhdx.b01.azurefd.net/downloads/53b7d0e07fe5c34bf68929fab92f87ce910288dc/macOS/StaticSitesClient",
"sha": "89ec4fe61217325e89ed849a564ffe4cc51b61c325abdca82e8e441a4959ec92"
}
}
},
"binary":"/home/aaaa/.swa/deploy/53b7d0e07fe5c34bf68929fab92f87ce910288dc/StaticSitesClient",
"checksum": "66fca4b42cbc64d451097931ca4ed75649233bd818f97f0c3f6d1d75cff61413"
}
```
However when running swa deploy command its still going to download metadata and failing while deployment
```
2025-01-06T12:14:18.8438630Z Fetching release metadata for version: stable. Please wait...
2025-01-06T12:14:18.8442385Z GET https://aka.ms/swalocaldeploy
2025-01-06T12:14:18.9487549Z Could not find release metadata; returning undefined
2025-01-06T12:14:18.9494834Z ✖
2025-01-06T12:14:18.9499827Z ✖ Deployment Failed :(
2025-01-06T12:14:18.9504798Z ✖ Deployment Failure Reason: Could not load StaticSitesClient metadata from remote. Please check your internet connection.
2025-01-06T12:14:18.9507266Z ✖ For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/azure/static-web-apps/
2025-01-06T12:14:18.9510175Z
```
We have setup HTTP_PROXY & HTTPS_PROXY as well before running SWA cli commands. But somehow it seems SWA commands are not considering these proxy settings.
Because, manually directly from machine when getting from this url using curl command then able to download. ex.
```
curl -x http://10.10.10.10.:443 -L aka.ms/swalocaldeploy
[
{
"version": "latest",
"buildId": "53b7d0e07fe5c34bf68929fab92f87ce910288dc",
"publishDate": "2024-10-24T20:43:23.5850191Z",
"files": {
"linux-x64": {
"url": "https://swalocaldeployv2-bndtgugjgqc3dhdx.b01.azurefd.net/downloads/53b7d0e07fe5c34bf68929fab92f87ce910288dc/linux/StaticSitesClient",
"sha": "66fca4b42cbc64d451097931ca4ed75649233bd818f97f0c3f6d1d75cff61413"
},
"win-x64": {
"url": "https://swalocaldeployv2-bndtgugjgqc3dhdx.b01.azurefd.net/downloads/53b7d0e07fe5c34bf68929fab92f87ce910288dc/windows/StaticSitesClient.exe",
"sha": "fc949fb19d29cce1e8b74cf1e2c31706426d46b3e03d830d601524cee63faa0b"
},
"osx-x64": {
"url": "https://swalocaldeployv2-bndtgugjgqc3dhdx.b01.azurefd.net/downloads/53b7d0e07fe5c34bf68929fab92f87ce910288dc/macOS/StaticSitesClient",
"sha": "89ec4fe61217325e89ed849a564ffe4cc51b61c325abdca82e8e441a4959ec92"
}
}
```
**Expected behavior**
- Option for SWA commands to consider Proxy configurations
- After manually downloaded StaticSitesClient and validated configured checksum, then direct deployment should work
コントリビューションガイド
調査の方向性
`aka.ms/swalocaldeploy` からリリースメタデータを取得する `swa deploy` パスから始め、次に `HTTP_PROXY` と `HTTPS_PROXY` がどのように処理されているか、また `.swa/deploy/StaticSitesClient.json` がどのように使用されているかを確認します。デプロイで、不要なリモートメタデータリクエストを行わずに、検証済みのローカル StaticSitesClient を使用でき、プロキシ設定が尊重されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- cli, cloud, networking
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100