I try to deploy my NestJs Application (uses the express adapter) to Azure App Services. In the docker logs I get this error:
2020-11-20T10:42:02.911Z INFO - docker run -d -p 8947:8080 --name xxx_0_37a36398 -e WEBSITES_PORT=8080 -e WEBSITE_SITE_NAME=xxx -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=xxx.azurewebsites.net -e WEBSITE_INSTANCE_ID=xxx appsvc/node:14-lts_20200918.1 yarn start:prod
2020-11-20T10:42:02.912Z INFO - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2020-11-20T10:42:05.088Z INFO - Initiating warmup request to container xxx_0_37a36398 for site xxx
2020-11-20T10:42:20.586Z INFO - Waiting for response to warmup request for container xxx_0_37a36398. Elapsed time = 15.4982001 sec
2020-11-20T10:48:35.794Z INFO - Waiting for response to warmup request for container xxx_0_37a36398. Elapsed time = 390.7060158 sec
2020-11-20T10:56:21.027Z INFO - Waiting for response to warmup request for container xxx_0_37a36398. Elapsed time = 855.9388558 sec
2020-11-20T11:04:08.996Z INFO - Waiting for response to warmup request for container xxx_0_37a36398. Elapsed time = 1323.907606 sec
2020-11-20T11:11:55.596Z INFO - Waiting for response to warmup request for container xxx_0_37a36398. Elapsed time = 1790.5073044 sec
2020-11-20T11:12:25.625Z ERROR - Container xxx_i_0_37a36398 for site xxx did not start within expected time limit. Elapsed time = 1820.5363685 sec
2020-11-20T11:12:25.627Z ERROR - Container xxx_0_37a36398 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2020-11-20T11:12:25.637Z INFO - Stopping site xxx because it failed during startup.
The Applications logs says that the application starts successful
2020-11-20T10:42:05.150205868Z _____
2020-11-20T10:42:05.150227670Z / _ \ __________ _________ ____
2020-11-20T10:42:05.150232970Z / /_\ \___ / | \_ __ \_/ __ \
2020-11-20T10:42:05.150237271Z / | \/ /| | /| | \/\ ___/
2020-11-20T10:42:05.150241271Z \____|__ /_____ \____/ |__| \___ >
2020-11-20T10:42:05.150245371Z \/ \/ \/
2020-11-20T10:42:05.150249272Z A P P S E R V I C E O N L I N U X
2020-11-20T10:42:05.150252972Z
2020-11-20T10:42:05.150256472Z Documentation: http://aka.ms/webapp-linux
2020-11-20T10:42:05.150260173Z NodeJS quickstart: https://aka.ms/node-qs
2020-11-20T10:42:05.150263673Z NodeJS Version : v14.7.0
2020-11-20T10:42:05.150267273Z Note: Any data outside '/home' is not persisted
2020-11-20T10:42:05.150270874Z
2020-11-20T10:42:05.388794060Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-11-20T10:42:05.389362508Z Could not find operation ID in manifest. Generating an operation id...
2020-11-20T10:42:05.389393011Z Build Operation ID: 5488a73a-f6e1-48d5-9360-7d4e0db141f4
2020-11-20T10:42:06.033354810Z Environment Variables for Application Insight's Codeless Configuration exists..
2020-11-20T10:42:06.603097828Z Writing output script to '/opt/startup/startup.sh'
2020-11-20T10:42:06.946048753Z Running #!/bin/sh
2020-11-20T10:42:06.946644503Z
2020-11-20T10:42:06.946657204Z # Enter the source directory to make sure the script runs where the user expects
2020-11-20T10:42:06.946662305Z cd "/home/site/wwwroot"
2020-11-20T10:42:06.946666105Z
2020-11-20T10:42:06.947939813Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2020-11-20T10:42:06.947952014Z if [ -z "$PORT" ]; then
2020-11-20T10:42:06.947956114Z export PORT=8080
2020-11-20T10:42:06.949015304Z fi
2020-11-20T10:42:06.954862399Z
2020-11-20T10:42:06.954927704Z export NODE_OPTIONS='--require /usr/local/lib/node_modules/applicationinsights/out/Bootstrap/Oryx.js ' $NODE_OPTIONS
2020-11-20T10:42:06.954986409Z PATH="$PATH:/home/site/wwwroot" yarn start:prod
2020-11-20T10:42:08.321443397Z yarn run v1.17.3
2020-11-20T10:42:08.484387733Z $ node dist/src/main
[...]
2020-11-20T10:42:23.394152218Z Application started on port 8080
I bind the express server with this line
const port = Number(process.env.PORT) || 8080;
I've googled for a while to find a solution but nothing helps. Here are the steps I tried util now.
- Increase
WEBSITES_CONTAINER_START_TIME_LIMIT
to 1800 - Set
WEBSITES_PORT
andPORT
Setting to 80 - Recreate and redeploy the application
Dose anyone have an idea why this problem still occurs? My app is listing on the right port and returns a 200 Http Status under /
and has also implemented a 400 Error handler (I've read that this cloud also a problem).
const port=process.env.PORT || 80
? Be sure that your application is listening on the port provided by the PORT environment variable: process.env.PORT. docs.microsoft.com/en-us/azure/app-service/…. Also make sure EXPOSE instruction in your Dockerfile matches with the port. – krishgPORT
. What do you mean with checking the docker file? I'm using the NodeJs runtime by Azure App Service. So I have no Dockerfile in my project.Or should I? – Markus