Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨

Home Page:https://aka.ms/swa/cli-local-development

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to deploy SWA from Ubuntu ( `ubuntu-latest` on Azure Pipelines Hosted Agent)

doggy8088 opened this issue · comments

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
  • 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

I was not able to deploy files using the following command under Ubuntu Linux.

swa deploy --app-location public --env production --verbose=silly

I already set SWA_CLI_DEPLOYMENT_TOKEN environment variables before running swa deploy command

I'll get the following error:

GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files

For the workaround, I reference from microsoft/vscode-docker#1515 and install gnome-keyring package before running above swa deploy command.

sudo apt install -y gnome-keyring

After that, I tried to run swa deploy again. I got the following errors.

2024-01-11T05:49:47.4044031Z ##[section]Starting: swa deploy
2024-01-11T05:49:47.4048267Z ==============================================================================
2024-01-11T05:49:47.4048395Z Task         : Command line
2024-01-11T05:49:47.4048451Z Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2024-01-11T05:49:47.4048553Z Version      : 2.231.1
2024-01-11T05:49:47.4048604Z Author       : Microsoft Corporation
2024-01-11T05:49:47.4048669Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2024-01-11T05:49:47.4048780Z ==============================================================================
2024-01-11T05:49:47.5190322Z Generating script.
2024-01-11T05:49:47.5208910Z Script contents:
2024-01-11T05:49:47.5212173Z swa deploy --app-location public --env production --verbose=silly
2024-01-11T05:49:47.5215249Z ========================== Starting Command Output ===========================
2024-01-11T05:49:47.5266219Z [command]/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/3409e7ef-bbb4-4d24-a7c9-1adee54e7330.sh
2024-01-11T05:49:48.1362336Z 
2024-01-11T05:49:48.1363064Z Welcome to Azure Static Web Apps CLI (1.1.6)
2024-01-11T05:49:48.1363140Z 
2024-01-11T05:49:48.1444434Z Getting config file options from "swa-cli.config.json"...
2024-01-11T05:49:48.1452619Z Config file does not exist at "swa-cli.config.json"
2024-01-11T05:49:48.1474375Z Resolving outputLocation=. full path...
2024-01-11T05:49:48.1481038Z Deploying front-end files from folder:
2024-01-11T05:49:48.1487775Z   /home/vsts/work/r1/a/_AP_ITASSETS-前端/drop/public
2024-01-11T05:49:48.1494338Z 
2024-01-11T05:49:48.1516453Z Consider providing api-language and version using --api-language and --api-version flags,
2024-01-11T05:49:48.1516808Z     otherwise default values apiLanguage: node and apiVersion: 16 will apply
2024-01-11T05:49:48.1524140Z No deployment token found. Trying interactive login...
2024-01-11T05:49:48.1532113Z Checking Azure session...
2024-01-11T05:49:48.1541416Z Executing authenticateWithAzureIdentity
2024-01-11T05:49:48.1548703Z - details:
2024-01-11T05:49:48.1552002Z   - tenantId: <undefined>
2024-01-11T05:49:48.1552286Z   - clientId: <undefined>
2024-01-11T05:49:48.1552497Z   - clientSecret: <undefined>
2024-01-11T05:49:48.1552656Z  - useKeychain: true
2024-01-11T05:49:48.1559803Z Keychain is enabled
2024-01-11T05:49:48.1567909Z Executing swaCliPersistencePlugin
2024-01-11T05:49:48.1629008Z Executing before cache access plugin
2024-01-11T05:49:48.1646457Z Machine ID: <hidden>
2024-01-11T05:49:48.1653135Z Invoking crypto service
2024-01-11T05:49:48.1662397Z Getting credentials
2024-01-11T05:49:48.1670608Z Getting credentials from native keychain
2024-01-11T05:49:48.1678021Z Getting keychain reference
2024-01-11T05:49:48.1684744Z isKeychainEnabled: true
2024-01-11T05:49:48.1692249Z KeychainCache: undefined
2024-01-11T05:49:48.1697870Z Attempting to load native keychain
2024-01-11T05:49:48.1996209Z Got native keychain reference
2024-01-11T05:49:48.2002557Z Got native keychain reference
2024-01-11T05:49:48.2106631Z Got credentials from native keychain: <empty>
2024-01-11T05:49:48.2112377Z Credentials not found in native keychain
2024-01-11T05:49:48.2118380Z Credentials: <empty>
2024-01-11T05:49:48.2124414Z Decrypted credentials: <empty>
2024-01-11T05:49:48.2130726Z Credentials: <empty>
2024-01-11T05:49:48.2137759Z Before cache access plugin. Done.
2024-01-11T05:49:48.2147639Z Executing after cache access plugin
2024-01-11T05:49:48.2153886Z Machine ID: <hidden>
2024-01-11T05:49:48.2165460Z Invoking crypto service
2024-01-11T05:49:48.2187594Z Did TokenCacheContext cache changed: true
2024-01-11T05:49:48.2187873Z Setting credentials in keychain
2024-01-11T05:49:48.2188021Z Encrypting credentials
2024-01-11T05:49:48.2196249Z Encrypted credentials: <hidden>
2024-01-11T05:49:48.2203764Z Setting credentials in native keychain
2024-01-11T05:49:48.2210847Z Getting keychain reference
2024-01-11T05:49:48.2215865Z isKeychainEnabled: true
2024-01-11T05:49:48.2221797Z KeychainCache: undefined
2024-01-11T05:49:48.2227816Z Attempting to load native keychain
2024-01-11T05:49:48.2245889Z Got native keychain reference
2024-01-11T05:49:48.2252104Z Got native keychain reference
2024-01-11T05:49:48.2259220Z Attempting to set credentials
2024-01-11T05:49:48.2574420Z Error attempting to set a credentials. Trying again... (0)
2024-01-11T05:49:48.4605517Z Attempting to set credentials
2024-01-11T05:49:48.4791789Z Error attempting to set a credentials. Trying again... (1)
2024-01-11T05:49:48.6825593Z Attempting to set credentials
2024-01-11T05:49:48.7006463Z Error attempting to set a credentials. Trying again... (2)
2024-01-11T05:49:48.9039461Z ✖ Cannot read properties of undefined (reading 'name')
2024-01-11T05:49:48.9180510Z 
2024-01-11T05:49:48.9350575Z ##[section]Finishing: swa deploy

To Reproduce
Steps to reproduce the behavior:

  1. Create a new project in Azure DevOps Service.

  2. Create a release pipeline and choose ubuntu-latest hosted agent.

    In the pipelines, I have to install swa first. => npm install -g @azure/static-web-apps-cli

    Setup SWA_CLI_DEPLOYMENT_TOKEN environment variable with a deployment token retrieved from Azure Portal.

    Put a simple HTML file under public folder.

    Add a task to deploy site: swa deploy --app-location public --env production --verbose=silly

  3. Create a release.

Expected behavior

I expected to deploy my site onto SWA correctly.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Ubuntu
  • Version: ubuntu-latest (Azure Pipeline's Hosted Agent)

Additional context

swa --version
1.1.6

Hi there - I am unable to reproduce this using the latest version of @azure/static-web-apps-cli (1.1.10) and installing via npm install -D.

If you are still having a problem with the latest version, please re-open and include information on:

  • Node version being used during deployment
  • The actual yaml for the publishing steps in Azure DevOps Pipeline.

Thanks!