id | title | sidebar_position |
---|---|---|
Troubleshooting |
Troubleshooting |
99 |
:::info This page lists frequently-asked questions and solutions to help troubleshoot common issues that may be encountered when building or testing the project. :::
swa deploy
currently has a small bug which is being actively worked on by the team. When a user tries to swa deploy
from within the app-location
, the deploy command currently fails with an unknown error. This is being tracked in GitHub issue #[514]((#514).
While the team is currently working on the fix, we recommend users to use the other methods of deployment, all documented here). In case the project does not have an app-location
folder (i.e. main project is in the root
folder), we'd recommend using the Azure Static Web Apps portal or VSCode extension meanwhile!
When using swa login
, the flag --use-keychain
is enabled by default because we encrypt and store your credentials in your native Keychain (aka. the built-in password manager of your operating system). This operation depends on a system dependency called libsecret
. If your system doesn't come bundled libsecret
(most systems do provide it by default), you will then encounter this error.
In order to be able to automatically deploy your app to your Azure Static Web Apps instance, we need a Deployment Token. To automate that operation and avoid asking the users to manually find that deployment token, which can take several steps, we provide a built-in and convenient option to do that: swa login
.
In order to avoid this issue, you have a few options:
- Manually install
libsecret
by adding it to your Docker image or your system (recommended) - Disable Keychain access using
--no-use-keychain
. Doing so won't store and remember your credentials anymore, and you will have to interactively log in again each time you runswa login
- Manually provide the Deployment Token for your current project (see SWA CLI docs). You will also need to provide
--app-name
and--resource-group
- Manually provide
--client-id
,--client-secret
,--app-name
and--resource-group
.
If you are having trouble accessing SWA CLI, the following domains need to be allowed an access in your firewall:
- blob.core.windows.net
- azurestaticapps.net
- swalocaldeploy.azureedge.net
- functionscdn.azureedge.net
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.
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
.
- Visit https://swalocaldeploy.azureedge.net/downloads/versions.json
- Copy the
stable
JSON content, for eg:
{
"version": "stable",
"buildId": "<StaticSiteClient version>",
"publishDate": "<publishDate>",
"files": {
"linux-x64": {
"url": "https://swalocaldeploy.azureedge.net/downloads/<StaticSitesClient version>/linux/StaticSitesClient",
"sha": "<Hash value of the StaticSitesClient Linux Binary>"
},
"win-x64": {
"url": "https://swalocaldeploy.azureedge.net/downloads/<StaticSitesClient version>/windows/StaticSitesClient.exe",
"sha": "<Hash value of the StaticSitesClient Windows Binary>"
},
"osx-x64": {
"url": "https://swalocaldeploy.azureedge.net/downloads/<StaticSitesClient version>/macOS/StaticSitesClient",
"sha": "<Hash value of the StaticSitesClient MacOS Binary>"
}
}
}
- Based on your operating system, download the right binary from the provided URLs:
- Linux: https://swalocaldeploy.azureedge.net/downloads//linux/StaticSitesClient
- Windows: https://swalocaldeploy.azureedge.net/downloads//windows/StaticSitesClient.exe
- macOS: https://swalocaldeploy.azureedge.net/downloads//macOS/StaticSitesClient
- Copy this binary to
$HOME/.swa/deploy/VERSION/StaticSiteClient
(add.exe
for Windows). For eg:/home/USER/.swa/deploy/<StaticSitesClient version>/StaticSiteClient
- Create a file at
$HOME/.swa/deploy/StaticSitesClient.json
with the following content:
{
"metadata": PASTE STABLE JSON CONTENT,
"binary": ABSOLUTE PATH TO STATIC SITE CLIENT BINARY,
"checksum": SH256 CHECKSUM OF THE BINARY SEE BELOW
}
For example:
{
"metadata": {
"version": "stable",
"buildId": "1.0.020761",
...
},
"binary":"/home/USER/.swa/deploy/1.0.020761/StaticSitesClient",
"checksum": "360b76959c68cc0865b1aea144c8eb2aa413f4856e55c781a83bd7e1ad352362"
}
IMPORTANT: Make sure the StaticSitesClient.json#checksum
and StaticSitesClient.json#metadata.files.[OS].sha
values match! 6. For Linux and macOS, run chmod +x /home/USER/.swa/deploy/<StaticSiteClient version>/StaticSitesClient
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.
How to compute SHA256 checksum:
- On Windows using Powershell:
PS C:\Users\USER> (Get-fileHash -Algorithm SHA256 .\.swa\deploy\VERSION\StaticSitesClient.exe).Hash.ToLower()
- On Linux:
➜ sha256sum ~/.swa/deploy/VERSION/StaticSitesClient | head -c 64
- On macOS:
➜ openssl sha256 ~/.swa/deploy/VERSION/StaticSitesClient | awk '{print $2}'