Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨
https://aka.ms/swa/cli-local-development
MIT License
583 stars 109 forks source link

swa deploy fails after 31 minutes due to failure to upload #837

Open NickNick opened 1 month ago

NickNick commented 1 month ago

Using swa version 1.1.8, which is the latest at the moment.

Describe the bug

swa deploy fails to deploy due to "Failed to upload app zip" ... "Uploading failed ... retry failed after 6 tries.".

To Reproduce Steps to reproduce the behavior:

  1. swa deploy --verbose silly --resource-group qms-rg --app-name qms --env production --app-location /tmp/cordys-package
  2. Wait for 32 minutes.
  3. Scroll down to
    ℹ Zipping App Artifacts
    ℹ App Zip will be created from directory: /tmp/cordys-package
    ℹ Done Zipping App Artifacts
    ℹ Uploading build artifacts.
    ℹ Failed to upload app zip, retrying...
    ℹ Failed to upload app zip, retrying...
    ✖ Uploading failed. Error message: Retry failed after 6 tries. Retry settings can be adjusted in ClientOptions.Retry. (The operation was cancelled because it exceeded the configured timeout of 0:01:40)
    ✖ Failed to upload build artifacts.
    ℹ 
    ℹ 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/

Expected behavior Successful deploy (this command worked in the past, nothing on my side changed).

Screenshots The full log:

❯ swa deploy --verbose silly --resource-group qms-rg --app-name qms --env production --app-location /tmp/cordys-package

Welcome to Azure Static Web Apps CLI (1.1.8)

Getting config file options from "swa-cli.config.json"...
Config file does not exist at "swa-cli.config.json"
(node:72558) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Resolving outputLocation=. full path...
Deploying front-end files from folder:
  /tmp/cordys-package

Consider providing api-language and version using --api-language and --api-version flags,
    otherwise default values apiLanguage: node and apiVersion: 16 will apply
No deployment token found. Trying interactive login...
Checking Azure session...
Executing authenticateWithAzureIdentity
- details:
  - tenantId: *****
  - 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: 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.
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.
✔ Successfully logged into Azure!
Selected tenant: ****
Selected subscription: ****
Project credentials:
 - subscriptionId: ****
 - tenantId: ****
 - clientId: <undefined>
 - clientSecret: <undefined>
Login successful

Checking project "qms" 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...
Static site found!
- staticSite:
  - id: /subscriptions/****/resourceGroups/qms-rg/providers/Microsoft.Web/staticSites/qms
  - name: qms
  - location: West US 2
  - type: Microsoft.Web/staticSites
 - sku:
   - name: Standard
   - tier: Standard
  - defaultHostname: blue-coast-0e44d291e.5.azurestaticapps.net
  - repositoryUrl:
  - branch:
 - customDomains:
   - 0: qms.cordys.health
 - privateEndpointConnections:
  - stagingEnvironmentPolicy: Disabled
  - allowConfigFileUpdates: true
  - contentDistributionEndpoint: https://content-wus2.infrastructure.5.azurestaticapps.net
  - keyVaultReferenceIdentity: SystemAssigned
 - userProvidedFunctionApps:
  - provider: SwaCli
  - enterpriseGradeCdnStatus: Disabled
Project settings:
 - resourceGroup: qms-rg
 - staticSiteName: qms
 - subscriptionId: ****
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.
✔ Successfully setup project!
No swa-cli.config.json file found. Skipping saving project settings.

Deployment token provided via remote configuration
 - deploymentToken: <hidden>

Deploying to environment: production

Trying to read workflow config with values:
 - appLocation: /tmp/cordys-package
 - outputLocation: /tmp/cordys-package
 - apiLocation: <undefined>
 - dataApiLocation: <undefined>
No workflow config folder found at /tmp/cordys-package/.github/workflows
Validating user workflow config (BEFORE):
 - appLocation: /tmp/cordys-package
 - outputLocation: /tmp/cordys-package
 - apiLocation: <undefined>
 - dataApiLocation: <undefined>
Validating user workflow config (AFTER):
 - appLocation: /tmp/cordys-package
 - apiLocation: <undefined>
 - outputLocation: /tmp/cordys-package
 - dataApiLocation: <undefined>
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:
  /tmp/cordys-package/staticwebapp.config.json

Deploying project to Azure Static Web Apps...
Fetching release metadata for version: stable. Please wait...
 - version: stable
 - buildId: 1.0.026911
 - publishDate: 2024-05-15T19:23:23.3973684Z
- files:
 - linux-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.026911/linux/StaticSitesClient
   - sha: e1d9e033c973a35f64b7e41b6a114bd8e48022c9c3f7676e79047e87245a874d
 - win-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.026911/windows/StaticSitesClient.exe
   - sha: c67e5eed2b28fcf5c98348732653d1e2b37d842e6dde9a6b30322832c5d86fc7
 - osx-x64:
   - url: https://swalocaldeploy.azureedge.net/downloads/1.0.026911/macOS/StaticSitesClient
   - sha: 18ca42a1b13db9b8b6db6bd8c77e65def56fa7bf3ce3fb1184e890d8cd7dd033
Local client binary is up to date. Skipping download.
Deploying using /Users/nick/.swa/deploy/1.0.026911/StaticSitesClient@1.0.026911
Deploying using the following options:
- env:
  - SWA_CLI_DEBUG: silly
  - SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
  - SWA_RUNTIME_CONFIG_LOCATION: /tmp/cordys-package
  - SWA_RUNTIME_CONFIG: /tmp/cordys-package/staticwebapp.config.json
  - SWA_CLI_VERSION: 1.1.8
  - SWA_CLI_DEPLOY_DRY_RUN: false
  - SWA_CLI_DEPLOY_BINARY: /Users/nick/.swa/deploy/1.0.026911/StaticSitesClient@1.0.026911
  - DEPLOYMENT_ACTION: upload
  - DEPLOYMENT_PROVIDER: SwaCli
  - REPOSITORY_BASE: /tmp/cordys-package
  - SKIP_APP_BUILD: true
  - SKIP_API_BUILD: true
  - DEPLOYMENT_TOKEN: <hidden>
  - APP_LOCATION: /tmp/cordys-package
  - API_LOCATION: <undefined>
  - DATA_API_LOCATION: <undefined>
  - CONFIG_FILE_LOCATION: /tmp/cordys-package
  - VERBOSE: true
  - FUNCTION_LANGUAGE: node
  - FUNCTION_LANGUAGE_VERSION: 16
ℹ DeploymentId: 26781771-cafc-40e1-9b8a-cadfb135ffd7
ℹ Preparing deployment. Please wait...
ℹ Verbose logging enabled
ℹ Try to validate location at: '/tmp/cordys-package/tmp/cordys-package'.
ℹ Build timeout not specified, defaulting to 15 minutes
ℹ App Directory Location: '/tmp/cordys-package' was found.
ℹ Try to validate location at: '/tmp/cordys-package/swa-db-connections'.
ℹ Try to validate location at: '/tmp/cordys-package/tmp/cordys-package/staticwebapp.config.json'.
ℹ config_file_location: config file '/tmp/cordys-package/staticwebapp.config.json' was found.
ℹ Looking for event info
ℹ Could not get event info. Proceeding
ℹ Skipping step to build /tmp/cordys-package with Oryx
ℹ Didn't find Oryx manifest file under location: /Users/nick/code/ams/26781771-cafc-40e1-9b8a-cadfb135ffd7-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.
ℹ Calculating the size of app artifacts: 21532031 B
ℹ No Api directory specified. Azure Functions will not be created.
ℹ Either no Api directory was specified, or the specified directory was not found. Azure Functions will not be created.
ℹ Zipping App Artifacts
ℹ App Zip will be created from directory: /tmp/cordys-package
ℹ Done Zipping App Artifacts
ℹ Uploading build artifacts.
ℹ Failed to upload app zip, retrying...
ℹ Failed to upload app zip, retrying...
✖ Uploading failed. Error message: Retry failed after 6 tries. Retry settings can be adjusted in ClientOptions.Retry. (The operation was cancelled because it exceeded the configured timeout of 0:01:40)
✖ Failed to upload build artifacts.
ℹ 
ℹ 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/

Desktop (please complete the following information):

Additional context The zip created is kept. It is just 19M: .rw-r--r-- 19M nick 24 May 20:08 .\d2d543f0-6c6c-43b6-b788-0f480ca9f7fa-app.zip

The information regarding timeouts is difficult to interpret, there is 2 times "Failed to upload app zip", but then the messages says "Retry failed after 6 tries" with a detail "The operation was cancelled because it exceeded the configured timeout of 00:01:40" (100 seconds), but the whole thing takes slightly over 31 minutes, so why doesn't it time out after 6*100 seconds then?