Skip to content

Commit 4af9624

Browse files
authored
docs: update troubleshooting with explainer #576 (#581)
1 parent 70c126e commit 4af9624

File tree

1 file changed

+80
-1
lines changed

1 file changed

+80
-1
lines changed

docs/www/docs/contribute/99-troubleshooting.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ sidebar_position: 99
99
:::info
1010
This page lists frequently-asked questions and solutions to help troubleshoot common issues that may be encountered when building or testing the project.
1111
:::
12-
## `swa deploy` - Current Caveat
12+
## `swa deploy` fails with no logs
1313

1414
### Context
1515

@@ -41,4 +41,83 @@ In order to avoid this issue, you have a few options:
4141
4. Manually provide `--client-id`, `--client-secret`, `--app-name` and `--resource-group`.
4242

4343

44+
## `Unable to download StaticSitesClient binary (File Not Found 404 - 403)`
45+
46+
### Context
47+
48+
SWA CLI uses an external binary `StaticSitesClient` to deploy apps to Azure Static Web Apps. This binary is downloaded on demand when users run `swa deploy` for the first time. SWA CLI then detects the host OS in order to download the right binary version from https://swalocaldeploy.azureedge.net/downloads/versions.json.
49+
50+
It can happen that the host firewall can block downloading these binaries. If users can't configure the firewall rules to allow SWA CLI accessing https://swalocaldeploy.azureedge.net/, as a workaround, they can manually download `StaticSitesClient`.
51+
52+
### Solution
53+
54+
1. Visit https://swalocaldeploy.azureedge.net/downloads/versions.json
55+
2. Copy the `stable` JSON content, for eg:
56+
```json
57+
{
58+
"version": "stable",
59+
"buildId": "1.0.020761",
60+
"publishDate": "2022-09-07T17:34:35.4261936Z",
61+
"files": {
62+
"linux-x64": {
63+
"url": "https://swalocaldeploy.azureedge.net/downloads/1.0.020761/linux/StaticSitesClient",
64+
"sha": "871ae9f154ddb8123e24c507e39dfc11c99f34815e59b178051a6e44a870e308"
65+
},
66+
"win-x64": {
67+
"url": "https://swalocaldeploy.azureedge.net/downloads/1.0.020761/windows/StaticSitesClient.exe",
68+
"sha": "360b76959c68cc0865b1aea144c8eb2aa413f4856e55c781a83bd7e1ad352362"
69+
},
70+
"osx-x64": {
71+
"url": "https://swalocaldeploy.azureedge.net/downloads/1.0.020761/macOS/StaticSitesClient",
72+
"sha": "1a90511003609af378ff3628feaf3115f9d7e335085a925045e9f206359fdb90"
73+
}
74+
}
75+
}
76+
```
77+
3. Based on your operating system, download the right binary from the provided URLs:
78+
1. Linux: https://swalocaldeploy.azureedge.net/downloads/1.0.020761/linux/StaticSitesClient
79+
2. Windows: https://swalocaldeploy.azureedge.net/downloads/1.0.020761/windows/StaticSitesClient.exe
80+
3. macOS: https://swalocaldeploy.azureedge.net/downloads/1.0.020761/macOS/StaticSitesClient
81+
1. Copy this binary to `$HOME/.swa/deploy/VERSION/StaticSiteClient` (add `.exe` for Windows). For eg:
82+
`/home/USER/.swa/deploy/1.0.020761/StaticSiteClient`
83+
1. Create a file at `$HOME/.swa/deploy/StaticSitesClient.json` with the following content:
84+
```json
85+
{
86+
"metadata": PASTE STABLE JSON CONTENT,
87+
"binary": ABSOLUTE PATH TO STATIC SITE CLIENT BINARY,
88+
"checksum": SH256 CHECKSUM OF THE BINARY SEE BELOW
89+
}
90+
```
91+
For eg:
92+
```json
93+
{
94+
"metadata": {
95+
"version": "stable",
96+
"buildId": "1.0.020761",
97+
...
98+
},
99+
"binary":"/home/USER/.swa/deploy/1.0.020761/StaticSitesClient",
100+
"checksum": SH256 CHECKSUM OF THE BINARY SEE BELOW
101+
}
102+
```
103+
104+
**IMPORTANT: Make sure the `StaticSitesClient.json#checksum` and `StaticSitesClient.json#metadata.files.[OS].sha` values match!**
105+
6. For Linux and macOS, run `chmod +x /home/USER/.swa/deploy/1.0.020761/StaticSitesClient`
106+
7. Run `swa deploy --verbose silly` and make sure `SWA_CLI_DEPLOY_BINARY` is set correctly. If everything was configured correctly, the deploy should work.
107+
108+
109+
How to compute SHA256 checksum:
110+
1. On Windows using Powershell:
111+
```
112+
PS C:\Users\USER> (Get-fileHash -Algorithm SHA256 .\.swa\deploy\VERSION\StaticSitesClient.exe).Hash.ToLower()
113+
```
114+
2. On Linux:
115+
```
116+
➜ sha256sum ~/.swa/deploy/VERSION/StaticSitesClient | head -c 64
117+
```
118+
3. On macOS:
119+
```
120+
➜ openssl sha256 ~/.swa/deploy/VERSION/StaticSitesClient | awk '{print $2}'
121+
```
122+
44123
---

0 commit comments

Comments
 (0)