Azure App Service + Node container failed to respond to HTTP Pings, Websites_Port already set

B Campbell 26 Reputation points
2022-10-06T13:55:45.45+00:00

I have a Node-Sails backend service that runs locally in Docker without issue (it checks a DB every minute so I can see if it's working), but after deploying to Azure App Service (on the free tier) the app gets killed for 'not responding to HTTP pings'.

Some details

  • My Dockerfile has 'EXPOSE 9007' since that's the port I'm using
  • Azure Application Settings has WEBSITES_PORT=9007 - this was all I needed to do for a separate app, although that was a React frontend on 9006 whereas this is a sails rest service
  • To deploy I'm doing 'docker build .' locally and then pushing the image to Azure Container Registry
  • Inbound traffic Access Restrictions are switched off
  • I've no options for Outbound traffic as I'm using the Free tier at the moment
  • Navigating to the App Service URL times-out (eventually showing the Azure broken app page), as does trying to access a GET endpoint on the URL.
  • Outbound traffic works as I can see it's able to query my DB
  • The Docker run string looks right from the logs - docker run -d --expose=9007 --name {my service name} -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=9007 -e WEBSITE_SITE_NAME={my service name} -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME={my service name} -e WEBSITE_INSTANCE_ID={some long uuid} -e WEBSITE_USE_DIAGNOSTIC_SERVER=False {my ACR name and image tag}

    Things I've tried already

  • Also setting PORT=9007 in Application Settings (no effect)
  • Increasing the timeout with WEBSITES_CONTAINER_START_LIMIT (it took longer before it was killed)
  • Changing the WEBSITE_SWAP_WARMUP_PING_PATH to one of the defined service endpoints (no effect)
  • Added the ICMP module to the service and started it listening when the sails app starts (no effect, no log of it receiving a ping)
  • Added a default route to the service to respond to any incoming traffic (no effect)
  • Added an index.html file (no effect)

Whenever I restart the service I get the same result from the log-streaming service; it says it's warming-up until the timeout expires, then it shuts down. When it shuts down it also shows me the log from Sails, proving that the container was actually up and running and talking to the outside world while the warmup said it was silent.

248078-console-1.png

248123-console-2.png

Questions

  • What exactly is an HTTP ping, because I understood ping was an ICMP operation? Is Azure actually doing an HTTP GET request, or something else?
  • Is there something I'm missing in my Node/Sails service that could be blocking these 'pings'?
  • As far as I can tell there are zero network restrictions on this App Service, so why can't I access it externally for the few minutes it runs before Azure shuts it down again?
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2022-10-10T12:49:01.32+00:00

    LostVoyager-0056, Apologies for the delay from over the weekend.

    Thanks for sharing great details about your scenario and things you have tried already.
    Kindly try the suggestion by lextm to change the binding. As code is listening on localhost, then it will not be accessible outside that specific container, hence, the app will fail to start. To get past this, make the app code listen on 0.0.0.0

    As I understand you’re hardcoding the port. Just to isolate, try with port 8080.
    If you haven't done, change this to use process.env.PORT.
    const port = process.env.port || 8080;

    Just to confirm, you mentioned that you used WEBSITES_CONTAINER_START_LIMIT vs WEBSITES_CONTAINER_START_TIME_LIMIT? -Yes, by default, if your container does not respond after 230 seconds, it will time out. (try with this - WEBSITES_CONTAINER_START_TIME_LIMIT app setting, set to 1800.


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.