SWA CLI Build failing after Oryx switched to Node 16.x as default
Bug Report
- At what date and time did you most recently experience the problem?
Nov 14th - 17:04 CET
-
Where did you experience the problem? E.g. Azure Web Apps, Azure Functions, Azure Container Registry, or offline use. Azure Static Web Apps Deployment through Azure Pipelines (.Net 6 api, Angular Frontend) - using Azure Web Apps CLI 1.0.3
-
If your repo is publicly available please share its URL: Non public
-
What happened? Build failed due to the keytar npm package (which the SWA CLI depends on) attempting to compile Python bindings against libsecret-1 which does fail because the library is not available in oryx. I don't know why it doesn't use the prebuild with npm.
-
What did you expect or want to happen? I would have hoped that changes to a build container maintained by Microsoft (Oryx) would not break builds using a CLI maintained by Microsoft (Azure Static Web Apps CLI). I found a workaround in setting the engine to "node 14.x" in package.json but I don't think that this is a long term solution (given that it works fine on dev machines using node 16.x).
C:\Users\xxx\source\repos\Project> npm list keytar
[email protected] C:\Users\xxx\source\repos\Project
└─┬ @azure/[email protected]
└── [email protected]
-
How can we reproduce it? If my assumption is correct that this is due to dependencies of the SWA CLI being incompatible with the current Oryx version it should affect all SWA builds on Oryx that don't specify a specific engine.
-
Do you have log output? Please include between the backticks:
2022-11-14T14:55:02.8010114Z ##[section]Starting: AzureStaticWebApp
2022-11-14T14:55:02.8016231Z ==============================================================================
2022-11-14T14:55:02.8016572Z Task : Deploy Azure Static Web App
2022-11-14T14:55:02.8016861Z Description : [PREVIEW] Build and deploy an Azure Static Web App
2022-11-14T14:55:02.8017134Z Version : 0.208.0
2022-11-14T14:55:02.8017338Z Author : Microsoft Corporation
2022-11-14T14:55:02.8017563Z Help : https://aka.ms/swadocs
2022-11-14T14:55:02.8017884Z ==============================================================================
2022-11-14T14:55:02.9607900Z [command]/usr/bin/bash /home/vsts/work/_tasks/AzureStaticWebApp_18aad896-e191-4720-88d6-8ced4806941a/0.208.0/launch-docker.sh
2022-11-14T14:55:03.3107584Z stable: Pulling from appsvc/staticappsclient
2022-11-14T14:55:03.3140701Z 6aefca2dc61d: Pulling fs layer
2022-11-14T14:55:03.3144369Z 967757d56527: Pulling fs layer
2022-11-14T14:55:03.3145748Z c357e2c68cb3: Pulling fs layer
2022-11-14T14:55:03.3146796Z c766e27afb21: Pulling fs layer
2022-11-14T14:55:03.3149590Z d913781da675: Pulling fs layer
2022-11-14T14:55:03.3171123Z 54fa687f58b4: Pulling fs layer
2022-11-14T14:55:03.3171991Z c939a09b5983: Pulling fs layer
2022-11-14T14:55:03.3172572Z e198984d5536: Pulling fs layer
2022-11-14T14:55:03.3173171Z 21e57609d6b3: Pulling fs layer
2022-11-14T14:55:03.3173702Z c1881f2146e9: Pulling fs layer
2022-11-14T14:55:03.3174261Z 4bd05412a8e0: Pulling fs layer
2022-11-14T14:55:03.3174777Z 8146c9dfd394: Pulling fs layer
2022-11-14T14:55:03.3175677Z f0ffa7b9e9dc: Pulling fs layer
2022-11-14T14:55:03.3176144Z 1bdd8cf46ef0: Pulling fs layer
2022-11-14T14:55:03.3263906Z 34595e92e24c: Pulling fs layer
2022-11-14T14:55:03.3264479Z 4d4551b540d9: Pulling fs layer
2022-11-14T14:55:03.3265276Z 3bfc743a8c7f: Pulling fs layer
2022-11-14T14:55:03.3265729Z 5bcbd9c2e895: Pulling fs layer
2022-11-14T14:55:03.3266171Z c766e27afb21: Waiting
2022-11-14T14:55:03.3266585Z d913781da675: Waiting
2022-11-14T14:55:03.3267050Z 54fa687f58b4: Waiting
2022-11-14T14:55:03.3267890Z c939a09b5983: Waiting
2022-11-14T14:55:03.3268397Z e198984d5536: Waiting
2022-11-14T14:55:03.3268795Z 21e57609d6b3: Waiting
2022-11-14T14:55:03.3269094Z c1881f2146e9: Waiting
2022-11-14T14:55:03.3269374Z 4bd05412a8e0: Waiting
2022-11-14T14:55:03.3269677Z 8146c9dfd394: Waiting
2022-11-14T14:55:03.3269936Z f0ffa7b9e9dc: Waiting
2022-11-14T14:55:03.3270183Z 1bdd8cf46ef0: Waiting
2022-11-14T14:55:03.3270429Z 34595e92e24c: Waiting
2022-11-14T14:55:03.3270691Z 4d4551b540d9: Waiting
2022-11-14T14:55:03.3270936Z 3bfc743a8c7f: Waiting
2022-11-14T14:55:03.3271193Z 5bcbd9c2e895: Waiting
2022-11-14T14:55:03.4654444Z c357e2c68cb3: Verifying Checksum
2022-11-14T14:55:03.4654860Z c357e2c68cb3: Download complete
2022-11-14T14:55:03.4676282Z 967757d56527: Verifying Checksum
2022-11-14T14:55:03.4676609Z 967757d56527: Download complete
2022-11-14T14:55:03.7910405Z 6aefca2dc61d: Verifying Checksum
2022-11-14T14:55:03.7912715Z 6aefca2dc61d: Download complete
2022-11-14T14:55:04.0136212Z c766e27afb21: Verifying Checksum
2022-11-14T14:55:04.0136599Z c766e27afb21: Download complete
2022-11-14T14:55:04.0540551Z 54fa687f58b4: Verifying Checksum
2022-11-14T14:55:04.0540906Z 54fa687f58b4: Download complete
2022-11-14T14:55:04.1130253Z e198984d5536: Verifying Checksum
2022-11-14T14:55:04.1136242Z e198984d5536: Download complete
2022-11-14T14:55:04.2791149Z 21e57609d6b3: Verifying Checksum
2022-11-14T14:55:04.2800306Z 21e57609d6b3: Download complete
2022-11-14T14:55:04.4142031Z c1881f2146e9: Verifying Checksum
2022-11-14T14:55:04.4142445Z c1881f2146e9: Download complete
2022-11-14T14:55:04.4842678Z c939a09b5983: Verifying Checksum
2022-11-14T14:55:04.4847543Z c939a09b5983: Download complete
2022-11-14T14:55:04.5426775Z 4bd05412a8e0: Verifying Checksum
2022-11-14T14:55:04.5427133Z 4bd05412a8e0: Download complete
2022-11-14T14:55:04.6671337Z d913781da675: Verifying Checksum
2022-11-14T14:55:04.6671732Z d913781da675: Download complete
2022-11-14T14:55:04.6672017Z f0ffa7b9e9dc: Verifying Checksum
2022-11-14T14:55:04.6672539Z f0ffa7b9e9dc: Download complete
2022-11-14T14:55:05.0727445Z 34595e92e24c: Verifying Checksum
2022-11-14T14:55:05.0733012Z 34595e92e24c: Download complete
2022-11-14T14:55:05.1794664Z 4d4551b540d9: Verifying Checksum
2022-11-14T14:55:05.1801895Z 4d4551b540d9: Download complete
2022-11-14T14:55:05.3040282Z 3bfc743a8c7f: Verifying Checksum
2022-11-14T14:55:05.3046098Z 3bfc743a8c7f: Download complete
2022-11-14T14:55:05.3149439Z 1bdd8cf46ef0: Verifying Checksum
2022-11-14T14:55:05.3149782Z 1bdd8cf46ef0: Download complete
2022-11-14T14:55:05.3520209Z 5bcbd9c2e895: Verifying Checksum
2022-11-14T14:55:05.3527856Z 5bcbd9c2e895: Download complete
2022-11-14T14:55:07.0666808Z 8146c9dfd394: Verifying Checksum
2022-11-14T14:55:07.0667168Z 8146c9dfd394: Download complete
2022-11-14T14:55:09.8531337Z 6aefca2dc61d: Pull complete
2022-11-14T14:55:10.2211652Z 967757d56527: Pull complete
2022-11-14T14:55:10.6081093Z c357e2c68cb3: Pull complete
2022-11-14T14:55:13.6276418Z c766e27afb21: Pull complete
2022-11-14T14:55:19.8670997Z d913781da675: Pull complete
2022-11-14T14:55:20.2363613Z 54fa687f58b4: Pull complete
2022-11-14T14:55:22.0621895Z c939a09b5983: Pull complete
2022-11-14T14:55:22.1166024Z e198984d5536: Pull complete
2022-11-14T14:55:22.1974110Z 21e57609d6b3: Pull complete
2022-11-14T14:55:22.2734197Z c1881f2146e9: Pull complete
2022-11-14T14:55:22.3575910Z 4bd05412a8e0: Pull complete
2022-11-14T14:55:33.2613951Z 8146c9dfd394: Pull complete
2022-11-14T14:55:33.6228001Z f0ffa7b9e9dc: Pull complete
2022-11-14T14:55:37.9189019Z 1bdd8cf46ef0: Pull complete
2022-11-14T14:55:38.7124379Z 34595e92e24c: Pull complete
2022-11-14T14:55:38.7655065Z 4d4551b540d9: Pull complete
2022-11-14T14:55:38.8163133Z 3bfc743a8c7f: Pull complete
2022-11-14T14:55:38.8680801Z 5bcbd9c2e895: Pull complete
2022-11-14T14:55:38.8720030Z Digest: sha256:87e0885bb199514dab1e4c2ac26894774d3039e6a3c77122c084c1320879447a
2022-11-14T14:55:38.8738637Z Status: Downloaded newer image for mcr.microsoft.com/appsvc/staticappsclient:stable
2022-11-14T14:55:39.2914653Z DeploymentId: 981d9e09-917a-4be3-acd4-ba64b4670991
2022-11-14T14:55:39.2916212Z
2022-11-14T14:55:39.4110588Z App Directory Location: '/' was found.
2022-11-14T14:55:39.4115136Z Looking for event info
2022-11-14T14:55:39.8958182Z Starting to build app with Oryx
2022-11-14T14:55:39.8963806Z Azure Static Web Apps utilizes Oryx to build both static applications and Azure Functions. You can find more details on Oryx here: https://github.com/microsoft/Oryx
2022-11-14T14:55:39.8965053Z ---Oryx build logs---
2022-11-14T14:55:39.8965748Z
2022-11-14T14:55:39.8966355Z
2022-11-14T14:55:40.3226152Z Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
2022-11-14T14:55:40.3233868Z You can report issues at https://github.com/Microsoft/Oryx/issues
2022-11-14T14:55:40.3239844Z
2022-11-14T14:55:40.3248703Z Oryx Version: 0.2.20221103.1, Commit: a2c65dde152b749fea395f4d1242ea9350942258, ReleaseTagName: 20221103.1
2022-11-14T14:55:40.3249380Z
2022-11-14T14:55:40.3258035Z Build Operation ID: |GlPvZqVuveQ=.8e7907a2_
2022-11-14T14:55:40.3258712Z Repository Commit : 32a7a0af6eb4faa5164549fed9b993582d976eee
2022-11-14T14:55:40.3264399Z
2022-11-14T14:55:40.3434182Z Detecting platforms...
2022-11-14T14:55:42.1107059Z Detected following platforms:
2022-11-14T14:55:42.1114388Z nodejs: 16.18.0
2022-11-14T14:55:42.1153813Z Version '16.18.0' of platform 'nodejs' is not installed. Generating script to install it...
2022-11-14T14:55:42.1758299Z Detected the following frameworks: Angular,Typescript
2022-11-14T14:55:42.2934098Z
2022-11-14T14:55:42.2996969Z
2022-11-14T14:55:42.3003525Z Source directory : /working_dir
2022-11-14T14:55:42.3004089Z Destination directory: /ss-oryx/app
2022-11-14T14:55:42.3004458Z
2022-11-14T14:55:42.3014326Z
2022-11-14T14:55:42.3017590Z Downloading and extracting 'nodejs' version '16.18.0' to '/opt/nodejs/16.18.0'...
2022-11-14T14:55:42.3050099Z Detected image debian flavor: bullseye.
2022-11-14T14:55:42.6309996Z Downloaded in 0 sec(s).
2022-11-14T14:55:42.6315831Z Verifying checksum...
2022-11-14T14:55:42.6379523Z Extracting contents...
2022-11-14T14:55:43.4619351Z performing sha512 checksum for: nodejs...
2022-11-14T14:55:43.5790474Z Done in 1 sec(s).
2022-11-14T14:55:43.5826638Z
2022-11-14T14:55:43.6417684Z Removing existing manifest file
2022-11-14T14:55:43.6462323Z Creating directory for command manifest file if it does not exist
2022-11-14T14:55:43.6470323Z Creating a manifest file...
2022-11-14T14:55:43.6470907Z Node Build Command Manifest file created.
2022-11-14T14:55:43.6476375Z
2022-11-14T14:55:43.6481464Z Using Node version:
2022-11-14T14:55:43.6536708Z v16.18.0
2022-11-14T14:55:43.6537111Z
2022-11-14T14:55:43.6542156Z Using Npm version:
2022-11-14T14:55:43.9458408Z 8.19.2
2022-11-14T14:55:43.9676394Z
2022-11-14T14:55:43.9676901Z Running 'npm install --unsafe-perm'...
2022-11-14T14:55:43.9677275Z
2022-11-14T14:56:51.5264233Z npm ERR! code 1
2022-11-14T14:56:51.5264797Z npm ERR! path /working_dir/node_modules/keytar
2022-11-14T14:56:51.5381749Z npm ERR! command failed
2022-11-14T14:56:51.5382365Z npm ERR! command sh -c -- prebuild-install || npm run build
2022-11-14T14:56:51.5382926Z npm ERR! > [email protected] build
2022-11-14T14:56:51.5383351Z npm ERR! > node-gyp rebuild
2022-11-14T14:56:51.5383921Z npm ERR! prebuild-install warn install EACCES: permission denied, access '/root/.npm'
2022-11-14T14:56:51.5384573Z npm ERR! npm WARN logfile Error: EACCES: permission denied, scandir '/root/.npm/_logs'
2022-11-14T14:56:51.5385306Z npm ERR! npm WARN logfile error cleaning log files [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
2022-11-14T14:56:51.5385885Z npm ERR! npm WARN logfile errno: -13,
2022-11-14T14:56:51.5386347Z npm ERR! npm WARN logfile code: 'EACCES',
2022-11-14T14:56:51.5386850Z npm ERR! npm WARN logfile syscall: 'scandir',
2022-11-14T14:56:51.5387347Z npm ERR! npm WARN logfile path: '/root/.npm/_logs'
2022-11-14T14:56:51.5387805Z npm ERR! npm WARN logfile }
2022-11-14T14:56:51.5388253Z npm ERR! gyp info it worked if it ends with ok
2022-11-14T14:56:51.5388948Z npm ERR! gyp info using [email protected]
2022-11-14T14:56:51.5389438Z npm ERR! gyp info using [email protected] | linux | x64
2022-11-14T14:56:51.5390077Z npm ERR! gyp info find Python using Python version 3.8.12 found at "/opt/python/latest/bin/python3"
2022-11-14T14:56:51.5390815Z npm ERR! gyp WARN EACCES current user does not have permission to access the dev dir "/root/.cache/node-gyp/16.18.0"
2022-11-14T14:56:51.5391521Z npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
2022-11-14T14:56:51.5392201Z npm ERR! gyp http GET https://nodejs.org/download/release/v16.18.0/node-v16.18.0-headers.tar.gz
2022-11-14T14:56:51.5392902Z npm ERR! gyp http 200 https://nodejs.org/download/release/v16.18.0/node-v16.18.0-headers.tar.gz
2022-11-14T14:56:51.5393583Z npm ERR! gyp http GET https://nodejs.org/download/release/v16.18.0/SHASUMS256.txt
2022-11-14T14:56:51.5394222Z npm ERR! gyp http 200 https://nodejs.org/download/release/v16.18.0/SHASUMS256.txt
2022-11-14T14:56:51.5394813Z npm ERR! gyp info spawn /opt/python/latest/bin/python3
2022-11-14T14:56:51.5395266Z npm ERR! gyp info spawn args [
2022-11-14T14:56:51.5395826Z npm ERR! gyp info spawn args '/working_dir/node_modules/node-gyp/gyp/gyp_main.py',
2022-11-14T14:56:51.5396366Z npm ERR! gyp info spawn args 'binding.gyp',
2022-11-14T14:56:51.5396832Z npm ERR! gyp info spawn args '-f',
2022-11-14T14:56:51.5397273Z npm ERR! gyp info spawn args 'make',
2022-11-14T14:56:51.5397724Z npm ERR! gyp info spawn args '-I',
2022-11-14T14:56:51.5398281Z npm ERR! gyp info spawn args '/working_dir/node_modules/keytar/build/config.gypi',
2022-11-14T14:56:51.5398798Z npm ERR! gyp info spawn args '-I',
2022-11-14T14:56:51.5399357Z npm ERR! gyp info spawn args '/working_dir/node_modules/node-gyp/addon.gypi',
2022-11-14T14:56:51.5399868Z npm ERR! gyp info spawn args '-I',
2022-11-14T14:56:51.5400559Z npm ERR! gyp info spawn args '/tmp/.node-gyp/16.18.0/include/node/common.gypi',
2022-11-14T14:56:51.5401130Z npm ERR! gyp info spawn args '-Dlibrary=shared_library',
2022-11-14T14:56:51.5401668Z npm ERR! gyp info spawn args '-Dvisibility=default',
2022-11-14T14:56:51.5402234Z npm ERR! gyp info spawn args '-Dnode_root_dir=/tmp/.node-gyp/16.18.0',
2022-11-14T14:56:51.5402874Z npm ERR! gyp info spawn args '-Dnode_gyp_dir=/working_dir/node_modules/node-gyp',
2022-11-14T14:56:51.5403550Z npm ERR! gyp info spawn args '-Dnode_lib_file=/tmp/.node-gyp/16.18.0/<(target_arch)/node.lib',
2022-11-14T14:56:51.5404215Z npm ERR! gyp info spawn args '-Dmodule_root_dir=/working_dir/node_modules/keytar',
2022-11-14T14:56:51.5404788Z npm ERR! gyp info spawn args '-Dnode_engine=v8',
2022-11-14T14:56:51.5405268Z npm ERR! gyp info spawn args '--depth=.',
2022-11-14T14:56:51.5405767Z npm ERR! gyp info spawn args '--no-parallel',
2022-11-14T14:56:51.5406269Z npm ERR! gyp info spawn args '--generator-output',
2022-11-14T14:56:51.5406756Z npm ERR! gyp info spawn args 'build',
2022-11-14T14:56:51.5407227Z npm ERR! gyp info spawn args '-Goutput_dir=.'
2022-11-14T14:56:51.5407681Z npm ERR! gyp info spawn args ]
2022-11-14T14:56:51.5408202Z npm ERR! Package libsecret-1 was not found in the pkg-config search path.
2022-11-14T14:56:51.5408800Z npm ERR! Perhaps you should add the directory containing `libsecret-1.pc'
2022-11-14T14:56:51.5409362Z npm ERR! to the PKG_CONFIG_PATH environment variable
2022-11-14T14:56:51.5461397Z npm ERR! No package 'libsecret-1' found
2022-11-14T14:56:51.5462181Z npm ERR! gyp: Call to 'pkg-config --cflags libsecret-1' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
2022-11-14T14:56:51.5462813Z npm ERR! gyp ERR! configure error
2022-11-14T14:56:51.5463497Z npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
2022-11-14T14:56:51.5464226Z npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/working_dir/node_modules/node-gyp/lib/configure.js:259:16)
2022-11-14T14:56:51.5464932Z npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
2022-11-14T14:56:51.5465732Z npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
2022-11-14T14:56:51.5466380Z npm ERR! gyp ERR! System Linux 5.15.0-1022-azure
2022-11-14T14:56:51.5467038Z npm ERR! gyp ERR! command "/opt/nodejs/16.18.0/bin/node" "/working_dir/node_modules/.bin/node-gyp" "rebuild"
2022-11-14T14:56:51.5467643Z npm ERR! gyp ERR! cwd /working_dir/node_modules/keytar
2022-11-14T14:56:51.5468130Z npm ERR! gyp ERR! node -v v16.18.0
2022-11-14T14:56:51.5468575Z npm ERR! gyp ERR! node-gyp -v v8.4.1
2022-11-14T14:56:51.5468990Z npm ERR! gyp ERR! not ok
2022-11-14T14:56:51.5469353Z
2022-11-14T14:56:51.5469775Z npm ERR! A complete log of this run can be found in:
2022-11-14T14:56:51.5470339Z npm ERR! /root/.npm/_logs/2022-11-14T14_55_44_218Z-debug-0.log
2022-11-14T14:56:52.6987007Z
2022-11-14T14:56:52.6987456Z
2022-11-14T14:56:52.6987863Z ---End of Oryx build logs---
2022-11-14T14:56:52.6988369Z Oryx has failed to build the solution.
2022-11-14T14:56:53.8053148Z
2022-11-14T14:56:53.8054549Z For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/en-us/azure/static-web-apps/
2022-11-14T14:56:53.8055715Z If you believe this behavior is unexpected, please raise a GitHub issue at https://github.com/azure/static-web-apps/issues/
2022-11-14T14:56:53.8056474Z Exiting
2022-11-14T14:56:54.2300075Z ##[error]Error: The process '/usr/bin/bash' failed with exit code 1
2022-11-14T14:56:54.2395217Z ##[section]Finishing: AzureStaticWebApp
Hi @OliverUlm. Thanks for submitting this issue. We understand it is a problem and are investigating a fix. For now, would you be able to attempt this workaround and let us know if it resolves your issue?
https://github.com/Azure/static-web-apps/issues/909#issuecomment-1320077142
Hi @pauld-msft Thanks for the link to this workaround. I just tried it and using the custom build command provided there I was able to complete a pipeline run without having to limit the engine to node 14. So it might be this permission problem that leads to keytar trying to compile a new binding.
Looking forward to seeing this resolved without the workaround but for now it works nicely given that I now can run the build with the same node version that I'm using during development. :)
Hi @OliverUlm, we merged in a fix for this issue (https://github.com/microsoft/Oryx/pull/1759) a few weeks ago, and it is currently rolling out to our various partners such as Azure App Service. As there is a workaround currently, and the real fix is going through deployment, I am going to go ahead and close this issue. Thanks again for reporting it.