Deployment in CD-Pipeline fails with "An unknown exception has occurred"
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 - [X] Yes, I am accessing the CLI from port
:4280
Make sure you are accessing the URL printed in the console when running
swa start!
ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly
Describe the bug
When trying to deploy a website that is built inside our CI/CD-Pipeline using the swacommand fails with the following error message: "An unknown exception has occurred". The same project using the same commands can be deployed from my computer. The page has been built with hugo.
To Reproduce I don't exactly know how to reproduce this. If this becomes relevant, i can try to provide a minimal example. Another Pipeline that deploys and Gatsby project exactly the same way does succeed.
Expected behavior I expect a succeeding deployment or at least a error message that describes the error.
Additional context Log output
$ swa deploy --verbose silly -d ${DEPLOYMENT_TOKEN} --env production --swa-config-location ./ ./public
Welcome to Azure Static Web Apps CLI (1.0.6)
Getting config file options from swa-cli.config.json...
Changed directory to <hidden>
Deploying front-end files from folder:
<hidden>/public
Deployment token provided via flag
- --deployment-token: <hidden>
Deploying to environment: production
Trying to read workflow config with values:
- appLocation: <hidden>
- outputLocation: <hidden>/public
- apiLocation: <undefined>
No workflow config folder found at <hidden>/.github/workflows
Validating user workflow config (BEFORE):
- appLocation: <hidden>
- outputLocation: <hidden>/public
- apiLocation: <undefined>
Validating user workflow config (AFTER):
- appLocation: <hidden>
- apiLocation: <undefined>
- outputLocation: <hidden>/public
Loading staticwebapp.config.json schema...
Schema loaded successfully from https://json.schemastore.org/staticwebapp.config.json
Compiling schema...
Reading content from staticwebapp.config.json...
Parsing staticwebapp.config.json...
Validating staticwebapp.config.json...
File validated successfully. Continuing with configuration!
Content parsed successfully
Found configuration file:
<hidden>/staticwebapp.config.json
Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
Fetching release metadata for version: stable. Please wait...
- version: stable
- buildId: 1.0.022431
- publishDate: 2023-02-21T18:46:09.9616432Z
- files:
- linux-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.022431/linux/StaticSitesClient
- sha: a0424f02b72b0e292e23fa1774a579f3a83cc2280af46a19682c11423e55a134
- win-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.022431/windows/StaticSitesClient.exe
- sha: 78476f93e8357ebd5b6676c66747c6f0432084615a5cecaa43e4afbda2533176
- osx-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.022431/macOS/StaticSitesClient
- sha: 0f2dc106903167d5900d9875321fd99a11349d21177b4794495b45e3df175755
- Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.022431/linux/[email protected]
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.022431/linux/[email protected]
Checksum match: a0424f02b72b0e292e23fa1774a579f3a83cc2280af46a19682c11423e55a134
Saved binary to /home/swa-cli/.swa/deploy/1.0.022431/StaticSitesClient
Saved metadata to /home/swa-cli/.swa/deploy/StaticSitesClient.json
Deploying using /home/swa-cli/.swa/deploy/1.0.022431/[email protected]
Deploying using the following options:
- env:
- SWA_CLI_DEBUG: silly
- SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
- SWA_RUNTIME_CONFIG_LOCATION: <hidden>
- SWA_RUNTIME_CONFIG: <hidden>/staticwebapp.config.json
- SWA_CLI_VERSION: 1.0.6
- SWA_CLI_DEPLOY_DRY_RUN: false
- SWA_CLI_DEPLOY_BINARY: /home/swa-cli/.swa/deploy/1.0.022431/[email protected]
- DEPLOYMENT_ACTION: upload
- DEPLOYMENT_PROVIDER: SwaCli
- REPOSITORY_BASE: <hidden>
- SKIP_APP_BUILD: true
- SKIP_API_BUILD: true
- DEPLOYMENT_TOKEN: <hidden>
- APP_LOCATION: <hidden>/public
- API_LOCATION: <undefined>
- CONFIG_FILE_LOCATION: <hidden>
- VERBOSE: true
- Preparing deployment. Please wait...
ℹ DeploymentId: 32e5ae21-65da-4799-b9de-35704456f028
ℹ Verbose logging enabled
ℹ Build timeout not specified, defaulting to 15 minutes
ℹ App Directory Location: '<hidden>/public' was found.
ℹ config_file_location: config file '<hidden>/staticwebapp.config.json' was found.
ℹ Looking for event info
ℹ Could not get event info. Proceeding
ℹ Skipping step to build <hidden>/public with Oryx
ℹ Didn't find Oryx manifest file under location: <hidden>/32e5ae21-65da-4799-b9de-35704456f028-swa-oryx/app-manifest/oryx-manifest.toml
ℹ Determined default file to be: index.html
ℹ Using 'staticwebapp.config.json' file for configuration information, 'routes.json' will be ignored.
✖ An unknown exception has occurred
ℹ
ℹ For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
ℹ If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
Hi @alexzimmer96, the issue you're facing is not clear but can you check the troubleshooting guide and see if it is the same?
Also, @alexzimmer96 can you provide the minimal example where this issue is reproducible?
Hi @sgollapudi77, the troubleshooting guide did not help. I try to setup a repository to reproduce this, but like i already mentioned, when i run the same commands it works from my machine. Also, another CI/CD-Pipeline that runs exactly the same commands but deploying another Static Webapp Resource in Azure works like a charm.
EDIT: I just figured out that i can reproduce this problem when is use the official docker image. This image is also used in both CI/CD pipelines.
i was able to workaround a similar issue by using the node image in CI instead of the SWA CLI image then installing through npm.
is it possible the SWA CLI docker image is behind the latest version?