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

[Bug]: swa start --data-api-location causing Bad CPU type in executable #1685

Closed
1 task done
bianbianzhu opened this issue Sep 5, 2023 · 7 comments
Closed
1 task done
Labels
3rd-party-integration bug Something isn't working cri Customer Reported issue swa Issue is on the swa, swa cli side swa-integration changes related to swa integration

Comments

@bianbianzhu
Copy link

What happened?

OS: [macOS]
Version [Ventura 13.4]
Architecture: [arm64 (Apple M2 Pro)]

When running the command to start the SWA using

swa start --data-api-location swa-db-connections

The following error occurred - Bad CPU type in executable

[dataApi] /bin/sh: /Users/tianyili/.swa/dataApiBuilder/0.8.49/Microsoft.DataApiBuilder: Bad CPU type in executable
[dataApi] cd "/Users/tianyili/Development/freshfarmpicking-react/swa-db-connections" && "/Users/tianyili/.swa/dataApiBuilder/0.8.49/Microsoft.DataApiBuilder" start -c staticwebapp.database.config.json --no-https-redirect exited with code 126
--> Sending SIGTERM to other processes..
[swa] node "/Users/tianyili/.nvm/versions/node/v18.17.1/lib/node_modules/@azure/static-web-apps-cli/dist/msha/server.js" exited with code SIGTERM
--> Sending SIGTERM to other processes..
[run] cd "/Users/tianyili/Development/freshfarmpicking-react/src/web" && yarn run dev  exited with code SIGTERM
✖ SWA emulator stoped because the --run command exited with code SIGTERM.

--data-api-location sets the swa-db-connections and declares where to run DataApiBuilder.exe to connect to the database.

If I change the options flag to --api-locaiton without the db connections, it works fine and no error is shown.

Is there any way to support the new Apple silicon chip plz?

Version

0.8.49

What database are you using?

Azure SQL

What hosting model are you using?

Static Web Apps (SWA)

Which API approach are you accessing DAB through?

REST

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@bianbianzhu bianbianzhu added bug Something isn't working triage issues to be triaged labels Sep 5, 2023
@seantleonard
Copy link
Contributor

Hi @bianbianzhu, which version of SWA CLI are you using?

There was a possible similar issue #1560 recently which required a bugfix to be deployed on SWA CLI: Azure/static-web-apps-cli#718
New version of SWA CLI: https://github.com/Azure/static-web-apps-cli/releases/tag/v1.1.4

@seantleonard
Copy link
Contributor

You can get additional logging by using the following SWA CLI option per https://azure.github.io/static-web-apps-cli/docs/cli/swa#options

swa start --verbose silly [args]

@bianbianzhu
Copy link
Author

Hi @seantleonard, thanks for the help.
The version of SWA CLI is 1.1.4
and the full log from swa start --verbose=silly is

Welcome to Azure Static Web Apps CLI (1.1.4)

Getting config file options from swa-cli.config.json...
Changed directory to /Users/tianyili/Development/freshfarmpicking-react
Using configuration "freshfarmpicking-react" from file:
  /Users/tianyili/Development/freshfarmpicking-react/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 dist
Api Dev Server found: http://127.0.0.1:7071
Trying to read workflow config with values:
 - appLocation: /Users/tianyili/Development/freshfarmpicking-react/src/web
 - outputLocation: http://localhost:3000
 - apiLocation: http://127.0.0.1:7071
Detected dev server configuration
User workflow config:
 - appLocation: /Users/tianyili/Development/freshfarmpicking-react/src/web
 - outputLocation: http://localhost:3000
 - apiLocation: http://127.0.0.1:7071
Running echo 'No Data API found'. Skipping
Starting the SWA emulator with the following configuration:
- ssl:
  - 0: false
  - 1: <undefined>
  - 2: <undefined>
- env:
  - SWA_RUNTIME_CONFIG_LOCATION: /Users/tianyili/Development/freshfarmpicking-react/src/web
  - SWA_RUNTIME_WORKFLOW_LOCATION: <undefined>
  - SWA_CLI_DEBUG: silly
  - SWA_CLI_API_PORT: 7071
  - SWA_CLI_APP_LOCATION: /Users/tianyili/Development/freshfarmpicking-react/src/web
  - SWA_CLI_OUTPUT_LOCATION: http://localhost:3000
  - SWA_CLI_API_LOCATION: http://127.0.0.1:7071
  - SWA_CLI_DATA_API_LOCATION: <undefined>
  - SWA_CLI_DATA_API_PORT: undefined
  - SWA_CLI_HOST: localhost
  - SWA_CLI_PORT: 4280
  - SWA_CLI_APP_SSL: false
  - SWA_CLI_APP_SSL_CERT: <undefined>
  - SWA_CLI_APP_SSL_KEY: <undefined>
  - SWA_CLI_STARTUP_COMMAND: yarn run dev 
  - SWA_CLI_VERSION: 1.1.4
  - SWA_CLI_SERVER_TIMEOUT: 60
  - SWA_CLI_OPEN_BROWSER: false
- commands:
  - swa: node "/Users/tianyili/.nvm/versions/node/v18.17.1/lib/node_modules/@azure/static-web-apps-cli/dist/msha/server.js"
  - api: <undefined>
  - dataApi: <undefined>
  - run: cd "/Users/tianyili/Development/freshfarmpicking-react/src/web" && yarn run dev 
yarn run v1.22.19
warning ../../../../package.json: No license field
$ vite
[swa] Loading staticwebapp.config.json schema...
[run] 2023-09-02T12:54:20.827Z vite:config bundled config file loaded in 138.89ms
[run] 2023-09-02T12:54:20.834Z vite:config using resolved config: {
[run]   plugins: [
[run]     'vite:optimized-deps',
[run]     'vite:watch-package-data',
[run]     'vite:pre-alias',
[run]     'alias',
[run]     'vite:react-babel',
[run]     'vite:react-refresh',
[run]     'vite:modulepreload-polyfill',
[run]     'vite:resolve',
[run]     'vite:html-inline-proxy',
[run]     'vite:css',
[run]     'vite:esbuild',
[run]     'vite:json',
[run]     'vite:wasm-helper',
[run]     'vite:worker',
[run]     'vite:asset',
[run]     'vite:wasm-fallback',
[run]     'vite:define',
[run]     'vite:css-post',
[run]     'vite:worker-import-meta-url',
[run]     'vite:asset-import-meta-url',
[run]     'vite:dynamic-import-vars',
[run]     'vite:import-glob',
[run]     'vite:client-inject',
[run]     'vite:import-analysis'
[run]   ],
[run]   server: {
[run]     preTransformRequests: true,
[run]     port: 3000,
[run]     sourcemapIgnoreList: [Function: isInNodeModules],
[run]     middlewareMode: false,
[run]     fs: { strict: true, allow: [Array], deny: [Array] }
[run]   },
[run]   resolve: {
[run]     mainFields: [ 'module', 'jsnext:main', 'jsnext' ],
[run]     browserField: true,
[run]     conditions: [],
[run]     extensions: [
[run]       '.mjs',  '.js',
[run]       '.mts',  '.ts',
[run]       '.jsx',  '.tsx',
[run]       '.json'
[run]     ],
[run]     dedupe: [ 'react', 'react-dom' ],
[run]     preserveSymlinks: false,
[run]     alias: [ [Object], [Object], [Object] ]
[run]   },
[run]   optimizeDeps: {
[run]     disabled: 'build',
[run]     force: undefined,
[run]     include: [ 'react', 'react/jsx-dev-runtime' ],
[run]     esbuildOptions: { preserveSymlinks: false }
[run]   },
[run]   esbuild: { jsxDev: true, jsx: 'automatic', jsxImportSource: undefined },
[run]   build: {
[run]     target: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
[run]     cssTarget: [ 'es2020', 'edge88', 'firefox78', 'chrome87', 'safari14' ],
[run]     outDir: 'dist',
[run]     assetsDir: 'assets',
[run]     assetsInlineLimit: 4096,
[run]     cssCodeSplit: true,
[run]     sourcemap: false,
[run]     rollupOptions: { onwarn: [Function: onwarn] },
[run]     minify: 'esbuild',
[run]     terserOptions: {},
[run]     write: true,
[run]     emptyOutDir: null,
[run]     copyPublicDir: true,
[run]     manifest: false,
[run]     lib: false,
[run]     ssr: false,
[run]     ssrManifest: false,
[run]     ssrEmitAssets: false,
[run]     reportCompressedSize: true,
[run]     chunkSizeWarningLimit: 500,
[run]     watch: null,
[run]     commonjsOptions: { include: [Array], extensions: [Array] },
[run]     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
[run]     modulePreload: { polyfill: true },
[run]     cssMinify: true
[run]   },
[run]   configFile: '/Users/tianyili/Development/freshfarmpicking-react/src/web/vite.config.ts',
[run]   configFileDependencies: [
[run]     '/Users/tianyili/Development/freshfarmpicking-react/src/web/vite.config.ts'
[run]   ],
[run]   inlineConfig: {
[run]     root: undefined,
[run]     base: undefined,
[run]     mode: undefined,
[run]     configFile: undefined,
[run]     logLevel: undefined,
[run]     clearScreen: undefined,
[run]     optimizeDeps: { force: undefined },
[run]     server: {}
[run]   },
[run]   root: '/Users/tianyili/Development/freshfarmpicking-react/src/web',
[run]   base: '/',
[run]   rawBase: '/',
[run]   publicDir: '/Users/tianyili/Development/freshfarmpicking-react/src/web/public',
[run]   cacheDir: '/Users/tianyili/Development/freshfarmpicking-react/src/web/node_modules/.vite',
[run]   command: 'serve',
[run]   mode: 'development',
[run]   ssr: {
[run]     format: 'esm',
[run]     target: 'node',
[run]     optimizeDeps: { disabled: true, esbuildOptions: [Object] }
[run]   },
[run]   isWorker: false,
[run]   mainConfig: null,
[run]   isProduction: false,
[run]   preview: {
[run]     port: undefined,
[run]     strictPort: undefined,
[run]     host: undefined,
[run]     https: undefined,
[run]     open: undefined,
[run]     proxy: undefined,
[run]     cors: undefined,
[run]     headers: undefined
[run]   },
[run]   envDir: '/Users/tianyili/Development/freshfarmpicking-react/src/web',
[run]   env: {
[run]     VITE_BLOB_SAS_TOKEN: '',
[run]     VITE_APP_INSIGHTS_CONNECTION_STRING: 'InstrumentationKey=xxx;IngestionEndpoint=http://xxx;LiveEndpoint=https://xxx',
[run]     VITE_AZURE_SEARCH_CLIENT_ENDPOINT: 'https://xxx',
[run]     VITE_AZURE_SEARCH_KEY_CREDENTIAL: 'xxx',
[run]     VITE_GOOGLEMAP_API_KEY: 'xxx',
[run]     BASE_URL: '/',
[run]     MODE: 'development',
[run]     DEV: true,
[run]     PROD: false
[run]   },
[run]   assetsInclude: [Function: assetsInclude],
[run]   logger: {
[run]     hasWarned: false,
[run]     info: [Function: info],
[run]     warn: [Function: warn],
[run]     warnOnce: [Function: warnOnce],
[run]     error: [Function: error],
[run]     clearScreen: [Function: clearScreen],
[run]     hasErrorLogged: [Function: hasErrorLogged]
[run]   },
[run]   packageCache: Map(1) {
[run]     'fnpd_/Users/tianyili/Development/freshfarmpicking-react/src/web' => {
[run]       dir: '/Users/tianyili/Development/freshfarmpicking-react/src/web',
[run]       data: [Object],
[run]       hasSideEffects: [Function: hasSideEffects],
[run]       webResolvedImports: {},
[run]       nodeResolvedImports: {},
[run]       setResolvedCache: [Function: setResolvedCache],
[run]       getResolvedCache: [Function: getResolvedCache]
[run]     },
[run]     set: [Function (anonymous)]
[run]   },
[run]   createResolver: [Function: createResolver],
[run]   worker: {
[run]     format: 'iife',
[run]     plugins: [
[run]       'vite:optimized-deps',
[run]       'vite:watch-package-data',
[run]       'vite:pre-alias',
[run]       'alias',
[run]       'vite:modulepreload-polyfill',
[run]       'vite:resolve',
[run]       'vite:html-inline-proxy',
[run]       'vite:css',
[run]       'vite:esbuild',
[run]       'vite:json',
[run]       'vite:wasm-helper',
[run]       'vite:worker',
[run]       'vite:asset',
[run]       'vite:wasm-fallback',
[run]       'vite:define',
[run]       'vite:css-post',
[run]       'vite:worker-import-meta-url',
[run]       'vite:asset-import-meta-url',
[run]       'vite:dynamic-import-vars',
[run]       'vite:import-glob',
[run]       'vite:client-inject',
[run]       'vite:import-analysis'
[run]     ],
[run]     rollupOptions: {},
[run]     getSortedPlugins: [Function: getSortedPlugins],
[run]     getSortedPluginHooks: [Function: getSortedPluginHooks]
[run]   },
[run]   appType: 'spa',
[run]   experimental: { importGlobRestoreExtension: false, hmrPartialAccept: false },
[run]   getSortedPlugins: [Function: getSortedPlugins],
[run]   getSortedPluginHooks: [Function: getSortedPluginHooks]
[run] }
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteTimeMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / corsMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use /__open-in-editor launchEditorMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteHMRPingMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteServePublicMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteTransformMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteServeRawFsMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteServeStaticMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteHtmlFallbackMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteIndexHtmlMiddleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / vite404Middleware
[run] Sat, 02 Sep 2023 12:54:20 GMT connect:dispatcher use / viteErrorMiddleware
[run] 2023-09-02T12:54:20.848Z vite:deps Hash is consistent. Skipping. Use --force to override.
[run] 2023-09-02T12:54:20.851Z vite:esbuild 20.09ms tsconfck init /Users/tianyili/Development/freshfarmpicking-react/src/web
[run] 
[run]   VITE v4.3.9  ready in 234 ms
[run] 
[run]   ➜  Local:   http://localhost:3000/
[run]   ➜  Network: use --host to expose
[swa] Schema loaded successfully from https://json.schemastore.org/staticwebapp.config.json
[swa] Compiling schema...
[swa] Reading content from staticwebapp.config.json...
[swa] Parsing staticwebapp.config.json...
[swa] Validating staticwebapp.config.json...
[swa] File validated successfully. Continuing with configuration!
[swa] Content parsed successfully
[swa] 
[swa] Found configuration file:
[swa]   /Users/tianyili/Development/freshfarmpicking-react/src/web/public/staticwebapp.config.json
[swa] 
[swa] Validating dev server config:
[swa]  - url: http://localhost:3000
[swa]  - timeout: 60
[swa] Checking if localhost:3000 is accepting TCP connections...
[swa] Validating dev server config:
[swa]  - url: http://127.0.0.1:7071
[swa]  - timeout: 60
[swa] Checking if 127.0.0.1:7071 is accepting TCP connections...
[swa] 
[swa] Using dev server for static content:
[swa]   http://localhost:3000
[swa] 
[swa] Using dev server for API:
[swa]   http://127.0.0.1:7071
[swa] 
[swa] Azure Static Web Apps emulator started at http://localhost:4280. Press CTRL+C to exit.
[swa] 
[swa] 

I was affected by the unzip and node 18 issue previously and thought as SWA 1.1.4 no longer uses unzipper, it could be a good solution for me.

Thanks!

@Aniruddh25
Copy link
Contributor

hi @bianbianzhu, in order to see the error, could you please reshare the verbose logs when --data-api-location argument is also given to swa start?

Something like:
swa start --data-api-location swa-db-connections --verbose=silly

Thanks!

@bianbianzhu
Copy link
Author

Hi @Aniruddh25, the following is the the complete log from
swa start --data-api-location swa-db-connections --verbose=silly

OS: [macOS]
Version [Ventura 13.4]
Architecture: [arm64 (Apple M2 Pro)]

SWA CLI 1.14
Data-api-builder 0.8.50

Welcome to Azure Static Web Apps CLI (1.1.4)

Getting config file options from swa-cli.config.json...
Changed directory to /Users/tianyili/Development/freshfarmpicking-react
Using configuration "freshfarmpicking-react" from file:
/Users/tianyili/Development/freshfarmpicking-react/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 dist
Api Dev Server found: http://127.0.0.1:7071
Data Api Folder found: /Users/tianyili/Development/freshfarmpicking-react/swa-db-connections
Trying to read workflow config with values:

  • appLocation: /Users/tianyili/Development/freshfarmpicking-react/src/web
  • outputLocation: http://localhost:3000
  • apiLocation: http://127.0.0.1:7071
    Detected dev server configuration
    User workflow config:
  • appLocation: /Users/tianyili/Development/freshfarmpicking-react/src/web
  • outputLocation: http://localhost:3000
  • apiLocation: http://127.0.0.1:7071
    Running dab --version
    dab is not installed.
    Downloading the version 0.8.50
    [swa] ✔ Downloading https://github.com/Azure/data-api-builder/releases/download/v0.8.50/dab_osx-x64-0.8.50.zip@0.8.50
    Checksum match: 0496fb0cc47b9bd9cdddb86f4cb8bdbeb4dd5b0a7ac521ad1a5f01416cb6feb2
    Saved binary to /Users/tianyili/.swa/dataApiBuilder/0.8.50/dab_osx-x64-0.8.50.zip
    Saved metadata to /Users/tianyili/.swa/dataApiBuilder/DataApiBuilder.json
    Setting executable permissions for data-api-builder binary
    DataApiBuilder found: /Users/tianyili/.swa/dataApiBuilder/0.8.50/Microsoft.DataApiBuilder. Using this to start data-api server
    Running cd "/Users/tianyili/Development/freshfarmpicking-react/swa-db-connections" && "/Users/tianyili/.swa/dataApiBuilder/0.8.50/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/tianyili/Development/freshfarmpicking-react/src/web
    • SWA_RUNTIME_WORKFLOW_LOCATION:
    • SWA_CLI_DEBUG: silly
    • SWA_CLI_API_PORT: 7071
    • SWA_CLI_APP_LOCATION: /Users/tianyili/Development/freshfarmpicking-react/src/web
    • SWA_CLI_OUTPUT_LOCATION: http://localhost:3000
    • SWA_CLI_API_LOCATION: http://127.0.0.1:7071
    • SWA_CLI_DATA_API_LOCATION: /Users/tianyili/Development/freshfarmpicking-react/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: yarn run dev
    • SWA_CLI_VERSION: 1.1.4
    • SWA_CLI_SERVER_TIMEOUT: 60
    • SWA_CLI_OPEN_BROWSER: false
  • commands:
    • swa: node "/Users/tianyili/.nvm/versions/node/v18.17.1/lib/node_modules/@azure/static-web-apps-cli/dist/msha/server.js"
    • api:
    • dataApi: cd "/Users/tianyili/Development/freshfarmpicking-react/swa-db-connections" && "/Users/tianyili/.swa/dataApiBuilder/0.8.50/Microsoft.DataApiBuilder" start -c staticwebapp.database.config.json --no-https-redirect
    • run: cd "/Users/tianyili/Development/freshfarmpicking-react/src/web" && yarn run dev
      [dataApi] /bin/sh: /Users/tianyili/.swa/dataApiBuilder/0.8.50/Microsoft.DataApiBuilder: Bad CPU type in executable
      [dataApi] cd "/Users/tianyili/Development/freshfarmpicking-react/swa-db-connections" && "/Users/tianyili/.swa/dataApiBuilder/0.8.50/Microsoft.DataApiBuilder" start -c staticwebapp.database.config.json --no-https-redirect exited with code 126
      --> Sending SIGTERM to other processes..
      [swa] node "/Users/tianyili/.nvm/versions/node/v18.17.1/lib/node_modules/@azure/static-web-apps-cli/dist/msha/server.js" exited with code SIGTERM
      --> Sending SIGTERM to other processes..
      [run] cd "/Users/tianyili/Development/freshfarmpicking-react/src/web" && yarn run dev exited with code SIGTERM
      ✖ SWA emulator stoped because the --run command exited with code SIGTERM.

Cheers!

@bianbianzhu
Copy link
Author

hmm, no body else has the same issue as me? I thought M2 Pro was not so different from M1

@seantleonard seantleonard added swa-integration changes related to swa integration swa Issue is on the swa, swa cli side 3rd-party-integration and removed triage issues to be triaged labels Feb 8, 2024
@seantleonard seantleonard added the cri Customer Reported issue label Apr 30, 2024
@JerryNixon
Copy link
Contributor

Close and waiting for future demand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd-party-integration bug Something isn't working cri Customer Reported issue swa Issue is on the swa, swa cli side swa-integration changes related to swa integration
Projects
None yet
Development

No branches or pull requests

5 participants