Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swa deploy fails with an unknown exception has occurred #500

Open
tmyllymaki opened this issue May 20, 2022 · 9 comments
Open

Swa deploy fails with an unknown exception has occurred #500

tmyllymaki opened this issue May 20, 2022 · 9 comments
Assignees
Labels
command: deploy All issues related to the deploy command scope: deploy-client Issues related to StaticSiteClient status: investigating The team is investigating the issues

Comments

@tmyllymaki
Copy link

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.

@manekinekko
Copy link
Member

Hey @tmyllymaki can you run the command again using --verbose=silly and share the logs?

@tmyllymaki
Copy link
Author

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/StaticSitesClient@1.0.019361
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/StaticSitesClient@1.0.019361
  - 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/

@Reshmi-Sriram
Copy link
Contributor

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!

@Reshmi-Sriram Reshmi-Sriram added scope: msha Issues happened a the ./src/msha level status: investigating The team is investigating the issues labels May 20, 2022
@sgollapudi77
Copy link
Contributor

Not able to reproduce this on my end.

@manekinekko manekinekko added the command: deploy All issues related to the deploy command label May 23, 2022
@manekinekko
Copy link
Member

Hey @tmyllymaki can you make sure your firewall is not blocking network access to the swa CLI?

@tmyllymaki
Copy link
Author

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.

@Reshmi-Sriram Reshmi-Sriram added scope: deploy-client Issues related to StaticSiteClient and removed scope: msha Issues happened a the ./src/msha level labels Jun 8, 2022
@thomasgauvin
Copy link
Contributor

May be related to #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

@RyanHill-MSFT
Copy link

@cjk7989
Copy link
Contributor

cjk7989 commented Sep 2, 2023

Hi @RyanHill-MSFT, did you meet the same issue? If so, and @tmyllymaki, could you tell me which framework did you use? Is it next.js? Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
command: deploy All issues related to the deploy command scope: deploy-client Issues related to StaticSiteClient status: investigating The team is investigating the issues
Projects
None yet
Development

No branches or pull requests

7 participants