projectkudu / kudu

Kudu is the engine behind git/hg deployments, WebJobs, and various other features in Azure Web Sites. It can also run outside of Azure.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AzureRmWebAppDeployment fails: select node version failed

koenigt opened this issue · comments

We have been running an AppService with NodeJS 14 LTS for several months now. Since thursday 06.10.22 all of a sudden the deployment fails because of a problem in the deploy.sh. Obiously there is a selectNodeVersion.js started which is assuming the node to be installed in a dedicated folder. We are running on Linux and the solution was working for several months.

We have upraged the platfrom runtime stack to Node18 LTS but got the same error. Also setting the Appsettings for:
WEBSITE_NODE_DEFAULT_VERSION=18.2.0
WEBSITE_NPM_DEFAULT_VERSION=6.14.15

didn't change anything. Any Ideas? Here are the Logs:

2022-10-12T16:24:48.4935624Z ##[section]Starting: AzureRmWebAppDeployment
2022-10-12T16:24:48.4949972Z ==============================================================================
2022-10-12T16:24:48.4950461Z Task : Azure App Service deploy
2022-10-12T16:24:48.4950821Z Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2022-10-12T16:24:48.4951191Z Version : 4.209.0
2022-10-12T16:24:48.4951391Z Author : Microsoft Corporation
2022-10-12T16:24:48.4951658Z Help : https://aka.ms/azureappservicetroubleshooting
2022-10-12T16:24:48.4951959Z ==============================================================================
2022-10-12T16:24:49.1177398Z Got service connection details for Azure App Service:'pbk-flx-frontend'
2022-10-12T16:24:50.8894579Z Package deployment using ZIP Deploy initiated.
2022-10-12T16:25:13.1928553Z Updating submodules.
2022-10-12T16:25:13.1931908Z Preparing deployment for commit id 'ba05fe52-6'.
2022-10-12T16:25:13.1934138Z PreDeployment: context.CleanOutputPath False
2022-10-12T16:25:13.1935929Z PreDeployment: context.OutputPath /home/site/wwwroot
2022-10-12T16:25:13.1937517Z Generating deployment script.
2022-10-12T16:25:13.5718363Z Using cached version of deployment script (command: 'azure -y --no-dot-deployment -r "/tmp/zipdeploy/extracted" -o "/home/site/deployments/tools" --node').
2022-10-12T16:25:13.5722308Z Running deployment command...
2022-10-12T16:25:13.9965077Z Command: "/home/site/deployments/tools/deploy.sh"
2022-10-12T16:25:13.9968000Z Handling node.js deployment.
2022-10-12T16:25:13.9969963Z Kudu sync from: '/tmp/zipdeploy/extracted' to: '/home/site/wwwroot'
2022-10-12T16:25:13.9971039Z Copying file: '403.html'
2022-10-12T16:25:13.9971898Z Copying file: '502.html'
2022-10-12T16:25:13.9972994Z Copying file: 'asset-manifest.json'
2022-10-12T16:25:13.9973937Z Copying file: 'favicon-32x32.webp'
2022-10-12T16:25:13.9974833Z Copying file: 'index.html'
2022-10-12T16:25:13.9975964Z Copying file: 'files/template.xlsx'
2022-10-12T16:25:13.9977131Z Copying file: 'static/css/main.b81cbb2e.css'
2022-10-12T16:25:13.9978265Z Copying file: 'static/css/main.b81cbb2e.css.map'
2022-10-12T16:25:13.9979382Z Copying file: 'static/js/main.41ed19b3.js'
2022-10-12T16:25:13.9980448Z Copying file: 'static/js/main.41ed19b3.js.LICENSE.txt'
2022-10-12T16:25:13.9981529Z Copying file: 'static/js/main.41ed19b3.js.map'
2022-10-12T16:25:13.9983569Z Copying file: 'static/media/DaimlerCS-Bold.28b41f4bcaefd0a37434.woff2'
2022-10-12T16:25:13.9984791Z Copying file: 'static/media/DaimlerCS-Bold.8f0ef04e7ecffae2e2cc.ttf'
2022-10-12T16:25:13.9986331Z Copying file: 'static/media/DaimlerCS-Bold.e9199b11f6d5a4c245bd.woff'
2022-10-12T16:25:13.9987505Z Copying file: 'static/media/DaimlerCS-BoldItalic.bf6be71df748067edb71.ttf'
2022-10-12T16:25:13.9988569Z /opt/Kudu/Scripts/selectNodeVersion.js:166
2022-10-12T16:25:13.9989881Z Copying file: 'static/media/DaimlerCS-BoldItalic.c99a396d4d84ff81938e.woff'
2022-10-12T16:25:13.9991038Z throw new Error('Unable to locate node.js installation directory at ' + nodejsDir);
2022-10-12T16:25:13.9992238Z Copying file: 'static/media/DaimlerCS-BoldItalic.ff70368acb7a6c40dc2f.woff2'
2022-10-12T16:25:13.9992842Z ^
2022-10-12T16:25:13.9993732Z Copying file: 'static/media/DaimlerCS-Demi.78d9a2ea880d00b2916c.woff'
2022-10-12T16:25:13.9994098Z
2022-10-12T16:25:13.9999725Z Copying file: 'static/media/DaimlerCS-Demi.be22c50501b549ce09e3.ttf'
2022-10-12T16:25:14.0000711Z Error: Unable to locate node.js installation directory at /opt/nodejs
2022-10-12T16:25:14.0002044Z Copying file: 'static/media/DaimlerCS-Demi.e85c95a86b2857edf261.woff2'
2022-10-12T16:25:14.0002839Z at Object. (/opt/Kudu/Scripts/selectNodeVersion.js:166:11)
2022-10-12T16:25:14.0004277Z Copying file: 'static/media/DaimlerCS-DemiItalic.583d0cb13adb762d7bf9.woff2'
2022-10-12T16:25:14.0005198Z at Module._compile (internal/modules/cjs/loader.js:1085:14)
2022-10-12T16:25:14.0006409Z Copying file: 'static/media/DaimlerCS-DemiItalic.9ec612fdbeca35b0bef2.ttf'
2022-10-12T16:25:14.0007852Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2022-10-12T16:25:14.0009580Z Copying file: 'static/media/DaimlerCS-DemiItalic.e6b5024100389d61d0b6.woff'
2022-10-12T16:25:14.0010407Z at Module.load (internal/modules/cjs/loader.js:950:32)
2022-10-12T16:25:14.0011356Z Copying file: 'static/media/DaimlerCS-ExtraBold.42ccbe90358ee83cd114.ttf'
2022-10-12T16:25:14.0011826Z at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2022-10-12T16:25:14.0012514Z Copying file: 'static/media/DaimlerCS-ExtraBold.ad443da73031a120595f.woff2'
2022-10-12T16:25:14.0013011Z at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)
2022-10-12T16:25:14.0013633Z Copying file: 'static/media/DaimlerCS-ExtraBold.ccc8a109e80b05bbea29.woff'
2022-10-12T16:25:14.0014054Z at internal/main/run_main_module.js:17:47
2022-10-12T16:25:14.0014641Z Copying file: 'static/media/DaimlerCS-ExtraBoldItalic.0e7075f3783135b9407b.ttf'
2022-10-12T16:25:14.0015295Z Copying file: 'static/media/DaimlerCS-ExtraBoldItalic.b1b0d62a8bdebcb29ee9.woff2'
2022-10-12T16:25:14.0015918Z Copying file: 'static/media/DaimlerCS-ExtraBoldItalic.c61c17d51967f2e69859.woff'
2022-10-12T16:25:14.0016533Z Copying file: 'static/media/DaimlerCS-Light.03d2a5525fa2b37b7eab.woff'
2022-10-12T16:25:14.0017136Z Copying file: 'static/media/DaimlerCS-Light.ab87eb50b1564c362a75.woff2'
2022-10-12T16:25:14.0017727Z Copying file: 'static/media/DaimlerCS-Light.b781254bca5205cba071.ttf'
2022-10-12T16:25:14.0018352Z Copying file: 'static/media/DaimlerCS-LightItalic.1429e5ded72f22368952.woff2'
2022-10-12T16:25:14.0018980Z Copying file: 'static/media/DaimlerCS-LightItalic.352fb29e0404e2f388b8.woff'
2022-10-12T16:25:14.0019598Z Copying file: 'static/media/DaimlerCS-LightItalic.670504e685f4b2ec2e3b.ttf'
2022-10-12T16:25:14.0020193Z Copying file: 'static/media/DaimlerCS-Regular.62fe8b5f3ce295a43d55.woff'
2022-10-12T16:25:14.0020799Z Copying file: 'static/media/DaimlerCS-Regular.c82fbee46f3b2334d6c9.ttf'
2022-10-12T16:25:14.0021416Z Copying file: 'static/media/DaimlerCS-Regular.cd341bf3d919d0ff0e42.woff2'
2022-10-12T16:25:14.0022021Z Copying file: 'static/media/DaimlerCS-RegularItalic.16bb5e77bc54e01f5709.woff2'
2022-10-12T16:25:14.0022658Z Copying file: 'static/media/DaimlerCS-RegularItalic.35b3bb116cb95ff34b19.woff'
2022-10-12T16:25:14.0023284Z Copying file: 'static/media/DaimlerCS-RegularItalic.35e68b515b6ce3ffd83b.ttf'
2022-10-12T16:25:14.0024138Z Copying file: 'static/media/EN.9a4d7abc6f920d0105bb.png'
2022-10-12T16:25:14.0024736Z Copying file: 'static/media/mb-white-logo.07e2d14ed2f0fb06cc5dd14367b43705.svg'
2022-10-12T16:25:14.0025154Z An error has occurred during web site deployment.
2022-10-12T16:25:14.0025553Z select node version failed
2022-10-12T16:25:14.0027681Z /opt/Kudu/Scripts/selectNodeVersion.js:166\n throw new Error('Unable to locate node.js installation directory at ' + nodejsDir);\n ^\n\nError: Unable to locate node.js installation directory at /opt/nodejs\n at Object. (/opt/Kudu/Scripts/selectNodeVersion.js:166:11)\n at Module._compile (internal/modules/cjs/loader.js:1085:14)\n at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n at Module.load (internal/modules/cjs/loader.js:950:32)\n at Function.Module._load (internal/modules/cjs/loader.js:790:12)\n at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)\n at internal/main/run_main_module.js:17:47\n/opt/Kudu/Scripts/starter.sh "/home/site/deployments/tools/deploy.sh"
2022-10-12T16:25:14.0030540Z Deployment Failed. deployer = VSTS_ZIP_DEPLOY deploymentPath = ZipDeploy. Extract zip.
2022-10-12T16:25:14.0064744Z ##[error]Failed to deploy web package to App Service.
2022-10-12T16:25:14.0079673Z ##[error]Error: Package deployment using ZIP Deploy failed. Refer logs for more details.
2022-10-12T16:25:17.9514298Z Successfully updated deployment History at https://pbk-flx-frontend-develop.scm.azurewebsites.net/api/deployments/27414801665591916334
2022-10-12T16:25:19.3219730Z App Service Application URL: http://pbk-flx-frontend-develop.azurewebsites.net
2022-10-12T16:25:19.3338396Z ##[section]Finishing: AzureRmWebAppDeployment

@koenigt did you solve this? seeing the same error suddenly

Hi @markdavies!

Yes the issue has been resolved. For some reasons we do not know the setting "SCM_SCRIPT_GENERATOR_ARGS=--node" was in our AppService Config. Since our complete built is done already in AzureDevops Pipeline we also set "SCM_DO_BUILD_DURING_DEPLOYMENT=false" but it looks like this setting is ignored somehow although it was working for a long time like this. We assume that due to an update of the runtime image somethings changed and that caused the issue. With the support of Microsoft we finally used the following settings:

  • "SCM_SCRIPT_GENERATOR_ARGS=--basic"
  • "SCM_DO_BUILD_DURING_DEPLOYMENT=false"
  • "ENABLE_ORYX_BUILD=false"

Like this our deployment is working again on Node 14 LTS, Node 16 LTS and on Node 18 LTS Runtime Stack. See also: https://github.com/projectkudu/kudu/wiki/Configurable-settings

Hi @koenigt , would you be able to offer any insight relating to #3453 ?

Hi @raph90 ,

i documented all that we found out in my comment: #3409 (comment)

Sorry to tell you that I do not have any more insights.

Regards
Thimo