Azure / Azure/static-web-apps-cli

Running swa locally on a arm64 with --data-api-location (CosmoDB connection) fails

Open
#703 1 comment 0 reactions 1 assignee Claimed by @Reshmi-Sriram View on GitHub
Dominant language
TypeScript
Stars
668
Forks
156
PR merge metrics
No merged PRs in 30d

Description

Before filing this issue, please ensure you're using the latest CLI by running `swa --version` and comparing to the latest version on [npm](https://www.npmjs.com/package/@azure/static-web-apps-cli).

**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**
I am following this tutorial, https://learn.microsoft.com/en-us/azure/static-web-apps/database-azure-cosmos-db?tabs=bash, to run Cosmo DB on my local desktop. When running, `swa start --data-api-location swa-db-connections --verbose=silly` I encounter a failure,
`[dataApi] /bin/sh: /Users/XXXX/.swa/dataApiBuilder/0.6.14/Microsoft.DataApiBuilder: cannot execute binary file`

**To Reproduce**
Steps to reproduce the behavior:

1. npm install -g @azure/static-web-apps-cli
2. npm update
3. swa start --data-api-location swa-db-connections --verbose=silly

**Expected behavior**
I expected swa to start with dab. I even tried to install dab locally, in the hopes swa would use the arm dba already installed.
Notice the version downloaded is, dab_osx-x64-0.6.14.zip@0.6.14 but this is an arm computer.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: MacOS
- Version 13.3.1 (a)

**Additional context**
Debug Logs:
MacBook-Pro:GatewayGamers XXXX$ swa start --data-api-location swa-db-connections --verbose=silly

Welcome to Azure Static Web Apps CLI (1.1.2)

Getting config file options from swa-cli.config.json...
Changed directory to /Users/XXXX/Documents/sourcecode/GatewayGamers
Using configuration "gateway-gamers" from file:
/Users/XXXX/Documents/sourcecode/GatewayGamers/swa-cli.config.json

***********************************************************************
* WARNING: This emulator may not match the cloud environment exactly. *
* Always deploy and test your app in Azure. *
***********************************************************************

Checking if localhost:4280 is accepting TCP connections...
Port 4280 is available. Use it.
Resolved port number: 4280
appDevserverUrl provided, we will try connect to dev server at build
Data Api Folder found: /Users/XXXX/Documents/sourcecode/GatewayGamers/swa-db-connections
Trying to read workflow config with values:
- appLocation: /Users/XXXX/Documents/sourcecode/GatewayGamers
- outputLocation: http://localhost:3000
- apiLocation:
Found a SWA workflow file: /Users/XXXX/Documents/sourcecode/GatewayGamers/.github/workflows/azure-static-web-apps-mango-sky-0c0b85b0f.yml
- app_build_command:
- api_build_command:
- app_location: /
- output_location: build
- api_location: api
- data_api_location:
Validating user workflow config (BEFORE):
- appLocation: /Users/XXXX/Documents/sourcecode/GatewayGamers
- outputLocation: http://localhost:3000
- apiLocation:
Validating user workflow config (AFTER):
- appLocation: /Users/XXXX/Documents/sourcecode/GatewayGamers
- apiLocation:
- outputLocation: http://localhost:3000
- dataApiLocation:
Workflow configuration:
- config:
- appBuildCommand:
- apiBuildCommand:
- appLocation: /Users/XXXX/Documents/sourcecode/GatewayGamers
- apiLocation:
- outputLocation: http://localhost:3000
- dataApiLocation:
- files:
- 0: /Users/XXXX/Documents/sourcecode/GatewayGamers/.github/workflows/azure-static-web-apps-mango-sky-0c0b85b0f.yml
User workflow config:
- appBuildCommand:
- apiBuildCommand:
- appLocation: /Users/XXXX/Documents/sourcecode/GatewayGamers
- apiLocation:
- outputLocation: http://localhost:3000
- dataApiLocation:
- files:
- 0: /Users/XXXX/Documents/sourcecode/GatewayGamers/.github/workflows/XXXX.yml
Running dab --version
Installed version: 0.7.6+61de247acf65280d93783072226f695536591ffb

Downloading the version 0.6.14
[swa] ✔ Downloading https://github.com/Azure/data-api-builder/releases/download/v0.6.14/dab_osx-x64-0.6.14.zip@0.6.14
Checksum match: 7965ba21b9c480a2ce87832b2f11655bfaae9726962aa0b194c39c31499290b3
Saved binary to /Users/XXXX/.swa/dataApiBuilder/0.6.14/dab_osx-x64-0.6.14.zip
Saved metadata to /Users/XXXX/.swa/dataApiBuilder/DataApiBuilder.json
Setting executable permissions for data-api-builder binary
DataApiBuilder found: /Users/XXXX/.swa/dataApiBuilder/0.6.14/Microsoft.DataApiBuilder. Using this to start data-api server
Running cd "/Users/XXXX/Documents/sourcecode/GatewayGamers/swa-db-connections" && "/Users/XXXX/.swa/dataApiBuilder/0.6.14/Microsoft.DataApiBuilder" start -c staticwebapp.database.config.json --no-https-redirect
Starting the SWA emulator with the following configuration:
- ssl:
- 0: false
- 1:
- 2:
- env:
- SWA_RUNTIME_CONFIG_LOCATION: /Users/XXXX/Documents/sourcecode/GatewayGamers
- SWA_RUNTIME_WORKFLOW_LOCATION: /Users/XXXX/Documents/sourcecode/GatewayGamers/.github/workflows/XXXX.yml
- SWA_CLI_DEBUG: silly
- SWA_CLI_API_PORT: 7071
- SWA_CLI_APP_LOCATION: /Users/XXXX/Documents/sourcecode/GatewayGamers
- SWA_CLI_OUTPUT_LOCATION: http://localhost:3000
- SWA_CLI_API_LOCATION:
- SWA_CLI_DATA_API_LOCATION: /Users/XXXX/Documents/sourcecode/GatewayGamers/swa-db-connections
- SWA_CLI_DATA_API_PORT: 5000
- SWA_CLI_HOST: localhost
- SWA_CLI_PORT: 4280
- SWA_CLI_APP_SSL: false
- SWA_CLI_APP_SSL_CERT:
- SWA_CLI_APP_SSL_KEY:
- SWA_CLI_STARTUP_COMMAND: npm start
- SWA_CLI_VERSION: 1.1.2
- SWA_CLI_SERVER_TIMEOUT: 60
- SWA_CLI_OPEN_BROWSER: false
- commands:
- swa: node "/Users/XXXX/.nvm/versions/node/v18.16.0/lib/node_modules/@azure/static-web-apps-cli/dist/msha/server.js"
- api:
- dataApi: cd "/Users/XXXX/Documents/sourcecode/GatewayGamers/swa-db-connections" && "/Users/XXXX/.swa/dataApiBuilder/0.6.14/Microsoft.DataApiBuilder" start -c staticwebapp.database.config.json --no-https-redirect
- run: cd "/Users/XXXX/Documents/sourcecode/GatewayGamers" && npm start
[dataApi] /bin/sh: /Users/XXXX/.swa/dataApiBuilder/0.6.14/Microsoft.DataApiBuilder: cannot execute binary file
[dataApi] cd "/Users/XXXX/Documents/sourcecode/GatewayGamers/swa-db-connections" && "/Users/XXXX/.swa/dataApiBuilder/0.6.14/Microsoft.DataApiBuilder" start -c staticwebapp.database.config.json --no-https-redirect exited with code 126
--> Sending SIGTERM to other processes..
[swa] node "/Users/XXXX/.nvm/versions/node/v18.16.0/lib/node_modules/@azure/static-web-apps-cli/dist/msha/server.js" exited with code SIGTERM
--> Sending SIGTERM to other processes..
[run] cd "/Users/XXXX/Documents/sourcecode/GatewayGamers" && npm start exited with code SIGTERM
✖ SWA emulator stoped because the --run command exited with code SIGTERM.

Note, dab is installed:
MacBook-Pro:GatewayGamers XXXX$ `dab --version`
Microsoft.DataApiBuilder 0.7.6+61de247acf65280d93783072226f695536591ffb

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.