Getting error for azure web app published from the vs code.

thomas magami 21 Reputation points
2023-03-28T16:41:47.31+00:00

I'm trying to publish the my sveltekit 1.0 application on the azure app service which runs fine locally on my machine with npm run preview.

When I publish the build folder and try to access the published sit I get error. I will really appreciate your response on this as I have stuck on this from long time. This is my build folder structure. I have set node build as a startup command in my app. I used node 18 LTS and Linux. I have tried using both port 3000 and 8080 by setting it in the configuration tab. But getting same error for both of them.

TUser's image

2023-03-28T16:33:59.021Z INFO - Starting container for site

2023-03-28T16:33:59.023Z INFO - docker run -d --expose=8080 --name cal-med-emr_0_a507fee4 -e PORT=8080 -e WEBSITE_SITE_NAME=cal-med-emr -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=cal-med-emr.azurewebsites.net -e WEBSITE_INSTANCE_ID=db3f3781635e5140d0607cce3dbb8c4be6e04b9cc61c46d779039e60d16e0789 -e WEBSITE_USE_DIAGNOSTIC_SERVER=True appsvc/node:16-lts_20230228.2.tuxprod node build

2023-03-28T16:33:59.024Z INFO - Logging is not enabled for this container.

Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.

2023-03-28T16:34:01.176Z INFO - Initiating warmup request to container cal-med-emr_0_a507fee4 for site cal-med-emr

2023-03-28T16:34:00.630914840Z _____

2023-03-28T16:34:00.630996242Z / _ \ __________ _________ ____

2023-03-28T16:34:00.631019542Z / /\ \__ / | _ __ _/ __ \

2023-03-28T16:34:00.631024343Z / | / /| | /| | /\ ___/

2023-03-28T16:34:00.631028743Z _| /_____ _/ || ___ >

2023-03-28T16:34:00.631033343Z / / /

2023-03-28T16:34:00.631037743Z A P P S E R V I C E O N L I N U X

2023-03-28T16:34:00.631041943Z

2023-03-28T16:34:00.631045943Z Documentation: http://aka.ms/webapp-linux

2023-03-28T16:34:00.631050043Z NodeJS quickstart: https://aka.ms/node-qs

2023-03-28T16:34:00.631054143Z NodeJS Version : v16.19.0

2023-03-28T16:34:00.631058343Z Note: Any data outside '/home' is not persisted

2023-03-28T16:34:00.631062443Z

2023-03-28T16:34:01.764430099Z Starting OpenBSD Secure Shell server: sshd.

2023-03-28T16:34:01.942340340Z Starting periodic command scheduler: cron.

2023-03-28T16:34:01.995411846Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'

2023-03-28T16:34:01.996273466Z Could not find operation ID in manifest. Generating an operation id...

2023-03-28T16:34:01.996292666Z Build Operation ID: d9815e3f-0a9a-4d43-9c95-42986298b2d5

2023-03-28T16:34:02.273322453Z Environment Variables for Application Insight's IPA Codeless Configuration exists..

2023-03-28T16:34:02.333966130Z Writing output script to '/opt/startup/startup.sh'

2023-03-28T16:34:02.463879778Z Running #!/bin/sh

2023-03-28T16:34:02.463945679Z

2023-03-28T16:34:02.463953380Z # Enter the source directory to make sure the script runs where the user expects

2023-03-28T16:34:02.463959280Z cd "/home/site/wwwroot"

2023-03-28T16:34:02.463964680Z

2023-03-28T16:34:02.463969880Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH

2023-03-28T16:34:02.463975080Z if [ -z "$PORT" ]; then

2023-03-28T16:34:02.463987880Z export PORT=8080

2023-03-28T16:34:02.463993781Z fi

2023-03-28T16:34:02.463998781Z

2023-03-28T16:34:02.465101706Z PATH="$PATH:/home/site/wwwroot" node build

2023-03-28T16:34:02.966109976Z node:internal/modules/cjs/loader:998

2023-03-28T16:34:02.966149577Z throw err;

2023-03-28T16:34:02.966157277Z ^

2023-03-28T16:34:02.966170577Z

2023-03-28T16:34:02.966176478Z Error: Cannot find module '/home/site/wwwroot/build'

2023-03-28T16:34:02.966181778Z at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)

2023-03-28T16:34:02.966186878Z at Function.Module._load (node:internal/modules/cjs/loader:841:27)

2023-03-28T16:34:02.966192178Z at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

2023-03-28T16:34:02.966212378Z at node:internal/main/run_main_module:22:47 {

2023-03-28T16:34:02.966217778Z code: 'MODULE_NOT_FOUND',

2023-03-28T16:34:02.966222579Z requireStack: []

2023-03-28T16:34:02.966227479Z }

2023-03-28T16:34:03.550Z ERROR - Container cal-med-emr_0_a507fee4 for site cal-med-emr has exited, failing site start

2023-03-28T16:34:03.582Z ERROR - Container cal-med-emr_0_a507fee4 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.

2023-03-28T16:34:03.643Z INFO - Stopping site cal-med-emr because it failed during startup.

I will really appreciate your help on this.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,925 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,173 questions
{count} votes

2 answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 21,771 Reputation points
    2023-03-29T09:23:17.92+00:00

    @thomas magami

    Thanks for reaching here! It seems you are using Zip Deploy (with Oryx Builder).

    So, If you are doing a Zip Deploy, and need your packages to be installed by the remote builder, which is Oryx, the App Setting SCM_DO_BUILD_DURING_DEPLOYMENT set to true must be added.

    Oryx Buidler App Setting

    As called out in the documentation here - the Zip package is assumed to be ready to run as-is. Otherwise, if you are not including your node_modules in the Zip - and do not have SCM_DO_BUILD_DURING_DEPLOYMENT set to true, you will run into module not found errors.

    The resolution in these scenarios with Zip Deploy is to add the App Setting SCM_DO_BUILD_DURING_DEPLOYMENT to true and attempt a redeployment

    More information on this Zip Deployment process can be found here on the GitHub projectkudu repository.

    Please let us know if further query or issue remains.


  2. David He (AU) 15 Reputation points
    2023-08-23T09:48:26.0133333+00:00

    Hey Sneha

    I have exactly the same issue and added changes per your reply but it still doesn't work.

    See logs

    2023-08-23T09:46:28.299206274Z # Enter the source directory to make sure the script runs where the user expects
    2023-08-23T09:46:28.299212274Z cd "/home/site/wwwroot"
    2023-08-23T09:46:28.299217775Z
    2023-08-23T09:46:28.299222675Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
    2023-08-23T09:46:28.299227776Z if [ -z "$PORT" ]; then
    2023-08-23T09:46:28.299232876Z 		export PORT=8080
    2023-08-23T09:46:28.299238377Z fi
    2023-08-23T09:46:28.299243277Z
    2023-08-23T09:46:28.309449571Z npm start
    2023-08-23T09:46:32.144736155Z npm info using npm@9.6.4
    2023-08-23T09:46:32.147205195Z npm info using node@v16.20.1
    2023-08-23T09:46:32.417100764Z
    2023-08-23T09:46:32.417194873Z > docker_web_app@1.0.0 start
    2023-08-23T09:46:32.417203274Z > node server.js
    2023-08-23T09:46:32.417209275Z
    2023-08-23T09:46:33.222067611Z node:internal/modules/cjs/loader:1031
    2023-08-23T09:46:33.222110515Z   throw err;
    2023-08-23T09:46:33.222118415Z   ^
    2023-08-23T09:46:33.222138017Z
    2023-08-23T09:46:33.222143818Z Error: Cannot find module 'express'
    2023-08-23T09:46:33.222149418Z Require stack:
    2023-08-23T09:46:33.222154819Z - /home/site/wwwroot/server.js
    2023-08-23T09:46:33.222160320Z     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
    2023-08-23T09:46:33.222165920Z     at Function.Module._load (node:internal/modules/cjs/loader:873:27)
    2023-08-23T09:46:33.222171421Z     at Module.require (node:internal/modules/cjs/loader:1100:19)
    2023-08-23T09:46:33.222177021Z     at require (node:internal/modules/cjs/helpers:108:18)
    2023-08-23T09:46:33.222182422Z     at Object.<anonymous> (/home/site/wwwroot/server.js:3:17)
    2023-08-23T09:46:33.222188522Z     at Module._compile (node:internal/modules/cjs/loader:1198:14)
    2023-08-23T09:46:33.222193923Z     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    2023-08-23T09:46:33.222199523Z     at Module.load (node:internal/modules/cjs/loader:1076:32)
    2023-08-23T09:46:33.222204924Z     at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    2023-08-23T09:46:33.222210324Z     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
    2023-08-23T09:46:33.222215825Z   code: 'MODULE_NOT_FOUND',
    2023-08-23T09:46:33.222221325Z   requireStack: [ '/home/site/wwwroot/server.js' ]
    2023-08-23T09:46:33.222226726Z }
    
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.