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

Abierto
#911 3 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
668
Forks
156
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con la ruta `swa deploy` que obtiene los metadatos de la versión desde `aka.ms/swalocaldeploy`; después, inspecciona cómo se gestionan `HTTP_PROXY` y `HTTPS_PROXY` y cómo se usa `.swa/deploy/StaticSitesClient.json`. El trabajo estará terminado cuando el despliegue pueda usar el StaticSitesClient local validado sin una solicitud remota de metadatos innecesaria y se respeten las configuraciones del proxy.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
typescript
Área
cli, cloud, networking
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.