static-web-apps-cli
static-web-apps-cli copied to clipboard
Swa deploy fails with an unknown exception has occurred
Describe the bug
Running swa deploy
always fails with:
Welcome to Azure Static Web Apps CLI (1.0.1)
Deploying front-end files from folder:
/private_path/Client/bin/publish/wwwroot
Deploying API from folder:
/private_path/Api
Checking Azure session...
✔ Successfully logged into Azure!
Checking project settings...
✔ Choose your Static Web App › app-rg/app-test
✔ Successfully setup project!
Deploying to environment: production
Found configuration file:
/private_path/Client/staticwebapp.config.json
Deploying project to Azure Static Web Apps...
✖ Failed to contact content server, stopping...
✖ An unknown exception has occurred
It manages to create the resource in Azure
To Reproduce Steps to reproduce the behavior:
Running swa deploy
with either swa-cli.config.json
or manual parameters.
Expected behavior Correct resources should be created and the app deployed.
Desktop (please complete the following information):
- OS: Ubuntu 22.04
Additional context
It's a blazor app with C# V4 functions Api.
Hey @tmyllymaki can you run the command again using --verbose=silly
and share the logs?
Removed some identifiers. Let me know if you need something else.
❯ swa deploy --verbose=silly
Welcome to Azure Static Web Apps CLI (1.0.1)
Getting config file options from swa-cli.config.json...
Changed directory to /app_path/src
Using configuration "app" from file:
/app_path/src/swa-cli.config.json
Deploying front-end files from folder:
/app_path/src/App.Client/bin/wwwroot
Deploying API from folder:
/app_path/src/App.Api
No deployment token found. Trying interactive login...
Checking Azure session...
Executing authenticateWithAzureIdentity
- details:
- tenantId: tenantId-removed
- clientId: <undefined>
- clientSecret: <undefined>
- useKeychain: true
Keychain is enabled
Executing swaCliPersistencePlugin
Executing before cache access plugin
Machine ID: <hidden>
Invoking crypto service
Getting credentials
Getting credentials from native keychain
Getting keychain reference
isKeychainEnabled: true
KeychainCache: undefined
Attempting to load native keychain
Got native keychain reference
Got native keychain reference
Got credentials from native keychain: <hidden>
Credentials found in native keychain
Credentials is chunked. Reading all chunks...
Got all chunks successfully
Credentials: <hidden>
Decrypting credentials
Decrypted credentials: <hidden>
Credentials content: <hidden>
Credentials: <hidden>
Before cache access plugin. Done.
Executing after cache access plugin
Machine ID: <hidden>
Invoking crypto service
Did TokenCacheContext cache changed: false
After cache access plugin. Done.
✔ Successfully logged into Azure!
Selected tenant: tenantId-removed
Selected subscription: subscriptionId-removed
Project credentials:
- subscriptionId: subscriptionId-removed
- tenantId: tenantId-removed
- clientId: <undefined>
- clientSecret: <undefined>
Login successful
Checking project "app-test" settings...
Executing before cache access plugin
Machine ID: <hidden>
Invoking crypto service
Getting credentials
Getting credentials from native keychain
Getting keychain reference
isKeychainEnabled: true
KeychainCache: undefined
Attempting to load native keychain
Got native keychain reference
Got native keychain reference
Got credentials from native keychain: <hidden>
Credentials found in native keychain
Credentials is chunked. Reading all chunks...
Got all chunks successfully
Credentials: <hidden>
Decrypting credentials
Decrypted credentials: <hidden>
Credentials content: <hidden>
Credentials: <hidden>
Before cache access plugin. Done.
Executing after cache access plugin
Machine ID: <hidden>
Invoking crypto service
Did TokenCacheContext cache changed: true
Setting credentials in keychain
Encrypting credentials
Encrypted credentials: <hidden>
Setting credentials in native keychain
Getting keychain reference
isKeychainEnabled: true
KeychainCache: undefined
Attempting to load native keychain
Got native keychain reference
Got native keychain reference
Credentials value is too long. Chunking it.
Setting credentials chunk #0 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #1 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #2 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #3 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #4 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #5 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #6 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #7 ...
Attempting to set credentials
Set credentials successfully
Setting credentials chunk #8 ...
Attempting to set credentials
Set credentials successfully
After cache access plugin. Done.
Only one project found. Trying to use it if the name matches...
✔ Would you like to create a new Azure Static Web Apps project? … yes
✔ Choose a project name: … SwaTest
⠹ Creating a new project...Resource group "app-test-rg" does not exist. Creating one...
⠴ Creating a new project... - id: /subscriptions/subscriptionId-removed/resourceGroups/app-test-rg
- name: app-test-rg
- type: Microsoft.Resources/resourceGroups
- properties:
- provisioningState: Succeeded
- location: westus2
Checking if project "swa-test" already exists...
⠇ Creating a new project...Caught error: The Resource 'Microsoft.Web/staticSites/swa-test' under resource group 'app-test-rg' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix
Creating static site "swa-test" in resource group "app-test-rg"...
⠹ Creating a new project...Static site "swa-test" created successfully.
- id: /subscriptions/subscriptionId-removed/resourceGroups/app-test-rg/providers/Microsoft.Web/staticSites/swa-test
- name: swa-test
- location: West US 2
- type: Microsoft.Web/staticSites
- sku:
- name: Free
- tier: Free
- defaultHostname: polite-pebble-02894111e.1.azurestaticapps.net
- repositoryUrl:
- branch:
- customDomains:
- privateEndpointConnections:
- stagingEnvironmentPolicy: Enabled
- allowConfigFileUpdates: true
- contentDistributionEndpoint: https://content-wus2.infrastructure.1.azurestaticapps.net
- keyVaultReferenceIdentity: SystemAssigned
- userProvidedFunctionApps:
- provider: None
- enterpriseGradeCdnStatus: Disabled
✔ Project created successfully!
Static site found!
- staticSite:
- id: /subscriptions/subscriptionId-removed/resourceGroups/app-test-rg/providers/Microsoft.Web/staticSites/swa-test
- name: swa-test
- location: West US 2
- type: Microsoft.Web/staticSites
- sku:
- name: Free
- tier: Free
- defaultHostname: polite-pebble-02894111e.1.azurestaticapps.net
- repositoryUrl:
- branch:
- customDomains:
- privateEndpointConnections:
- stagingEnvironmentPolicy: Enabled
- allowConfigFileUpdates: true
- contentDistributionEndpoint: https://content-wus2.infrastructure.1.azurestaticapps.net
- keyVaultReferenceIdentity: SystemAssigned
- userProvidedFunctionApps:
- provider: None
- enterpriseGradeCdnStatus: Disabled
Project settings:
- resourceGroupName: app-test-rg
- staticSiteName: swa-test
- subscriptionId: subscriptionId-removed
✔ Successfully setup project!
Saving project settings to swa-cli.config.json...
Updating configuration file at /app_path/src/swa-cli.config.json
Loading existing swa-cli.config.json file at /app_path/src/swa-cli.config.json
Deployment token provided via remote configuration
- deploymentToken: <hidden>
Deploying to environment: preview
Trying to read workflow config with values:
- appLocation: /app_path/src/App.Client
- outputLocation: /app_path/src/App.Client/bin/wwwroot
- apiLocation: /app_path/src/App.Api
No workflow config folder found at /app_path/src/App.Client/.github/workflows
Validating user workflow config (BEFORE):
- appLocation: /app_path/src/App.Client
- outputLocation: /app_path/src/App.Client/bin/wwwroot
- apiLocation: /app_path/src/App.Api
Validating user workflow config (AFTER):
- appLocation: /app_path/src/App.Client
- apiLocation: /app_path/src/App.Api
- outputLocation: /app_path/src/App.Client/bin/wwwroot
Writing configuration "app" to swa-cli.config.json
- appLocation: App.Client
- apiLocation: App.Api
- outputLocation: bin/wwwroot
- appBuildCommand: dotnet publish -c Release -o bin
- apiBuildCommand: dotnet publish -c Release
- run: dotnet watch run
- appDevserverUrl: http://localhost:5003
- appName: swa-test
- resourceGroupName: app-test-rg
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:
/app_path/src/App.Client/staticwebapp.config.json
Deploying project to Azure Static Web Apps...
Fetching release metadata for version: stable. Please wait...
- version: stable
- buildId: 1.0.019361
- publishDate: 2022-04-20T15:35:50.4947355Z
- files:
- linux-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/linux/StaticSitesClient
- sha: 24baa1cedd45b7b029f3ee502265de940383fab940e0bed75842cbf7f9030080
- win-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/windows/StaticSitesClient.exe
- sha: 66c529754df158761523aeffcc5f278d14205f6b51afec913ba113edc3caa681
- osx-x64:
- url: https://swalocaldeploy.azureedge.net/downloads/1.0.019361/macOS/StaticSitesClient
- sha: ec26ca4e7a12f46cee93b5d0b2128f79f18a3ff9875d7276a837ca94c16be854
Local client binary is up to date. Skipping download.
Deploying using /home/tm/.swa/deploy/1.0.019361/[email protected]
Deploying using the following options:
- env:
- SWA_CLI_DEBUG: silly
- SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
- SWA_RUNTIME_CONFIG_LOCATION: /app_path/src/App.Client
- SWA_RUNTIME_CONFIG: /app_path/src/App.Client/staticwebapp.config.json
- SWA_CLI_VERSION: 1.0.1
- SWA_CLI_DEPLOY_DRY_RUN: false
- SWA_CLI_DEPLOY_BINARY: /home/tm/.swa/deploy/1.0.019361/[email protected]
- DEPLOYMENT_ACTION: upload
- DEPLOYMENT_PROVIDER: swa-cli-1.0.1
- REPOSITORY_BASE: /app_path/src/App.Client
- SKIP_APP_BUILD: true
- SKIP_API_BUILD: true
- DEPLOYMENT_TOKEN: <hidden>
- APP_LOCATION: /app_path/src/App.Client/bin/wwwroot
- API_LOCATION: /app_path/src/App.Api
- CONFIG_FILE_LOCATION: /app_path/src/App.Client
- VERBOSE: true
- DEPLOYMENT_ENVIRONMENT: preview
ℹ DeploymentId: b8c46664-efd3-402d-814d-3459f889a9b3
ℹ
ℹ Verbose logging enabled
ℹ Build timeout not specified, defaulting to 15 minutes
ℹ App Directory Location: '/app_path/src/App.Client/bin/wwwroot' was found.
ℹ Api Directory Location: '/app_path/src/App.Api' was found.
ℹ config_file_location: config file '/app_path/src/App.Client/staticwebapp.config.json' was found.
ℹ Looking for event info
ℹ Event info parsed from action options.
ℹ Could not get repository branch. Proceeding
ℹ Could not get repository url. Proceeding
✖ Failed to contact content server, stopping...
✖ An unknown exception has occurred
✖ Failed to record upload telemtry.
ℹ
ℹ 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/
Hey @tmyllymaki, Thanks for sharing the logs. We are trying to repro the same on our end. Will update once we have a fix or any other asks.
Thank you!
Not able to reproduce this on my end.
Hey @tmyllymaki can you make sure your firewall is not blocking network access to the swa
CLI?
Disabling ufw didn't help. One thing I noticed was that I get a DeploymentId in my logs but there's not a single deployment under the created resource group.
May be related to https://github.com/Azure/static-web-apps-cli/issues/531 @tmyllymaki, though the solutions proposed in https://azure.github.io/static-web-apps-cli/docs/contribute/Troubleshooting/#swa-deploy---current-caveat aren't working for me