Nodejs application times out

Balkrishna Agarwal 1 Reputation point
2020-06-21T16:07:40.793+00:00

I am trying to run my nodejs app & I am getting the below timeout error

2020-06-21T15:54:59.923Z ERROR - Container readbetter_0_263e3638 for site readbetter did not start within expected time limit. Elapsed time = 240.6643687 sec
2020-06-21T15:54:59.943Z ERROR - Container readbetter_0_263e3638 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.

The log from KDU/SCM site

[{"machineName":"RD0003FF9A807F","lastUpdated":"2020-06-20T14:02:16.7548419Z","size":912,"href":"https://readbetter.scm.azurewebsites.net/api/vfs/LogFiles/2020_06_20_RD0003FF9A807F_docker.log","path":"/home/LogFiles/2020_06_20_RD0003FF9A807F_docker.log"},{"machineName":"RD0003FFAB07D9_default","lastUpdated":"2020-06-20T21:45:03.345089Z","size":16972,"href":"https://readbetter.scm.azurewebsites.net/api/vfs/LogFiles/2020_06_20_RD0003FFAB07D9_default_docker.log","path":"/home/LogFiles/2020_06_20_RD0003FFAB07D9_default_docker.log"},{"machineName":"RD0003FFAB07D9","lastUpdated":"2020-06-20T21:45:03.3919504Z","size":4564,"href":"https://readbetter.scm.azurewebsites.net/api/vfs/LogFiles/2020_06_20_RD0003FFAB07D9_docker.log","path":"/home/LogFiles/2020_06_20_RD0003FFAB07D9_docker.log"},{"machineName":"RD0003FFAACA0A_default","lastUpdated":"2020-06-21T15:54:59.9428138Z","size":45858,"href":"https://readbetter.scm.azurewebsites.net/api/vfs/LogFiles/2020_06_21_RD0003FFAACA0A_default_docker.log","path":"/home/LogFiles/2020_06_21_RD0003FFAACA0A_default_docker.log"},{"machineName":"RD0003FFAACA0A","lastUpdated":"2020-06-21T15:55:00.0053474Z","size":21791,"href":"https://readbetter.scm.azurewebsites.net/api/vfs/LogFiles/2020_06_21_RD0003FFAACA0A_docker.log","path":"/home/LogFiles/2020_06_21_RD0003FFAACA0A_docker.log"}]

I am totlly new to this. This is the first app I am trying to deploy. So please give as much details as possible. Thanks in Advance.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,370 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 20,471 Reputation points
    2020-06-22T09:09:57.68+00:00

    Thanks for asking question! It looks like container does not start in expected time limit and elapsed time is 240.66 sec.
    To elaborate on this when we start your container, we'll wait a while for it to start and initialize. We consider the startup to be successful once the container is running and once we get a response to a ping so that we know it's ready to respond to HTTP traffic. We'll wait 230 seconds which is default limit for that to happen. If we don't have a successful start within 230 seconds, we'll assume there's a problem and we'll stop the container.

    If containers need more time to start, then you need to increase that 230 second wait time up to a limit of 1800 seconds. To configure that, add an app setting called WEBSITES_CONTAINER_START_TIME_LIMIT and set it to the number of seconds you would like for us to wait for your container to start (up to a maximum of 1800).

    You may refer to below links for more details on this:

    https://learn.microsoft.com/en-us/azure/app-service/containers/app-service-linux-faq#custom-containers

    https://techcommunity.microsoft.com/t5/azure-app-service/things-you-should-know-web-apps-and-linux/ba-p/392472#ContainerStart

    https://techcommunity.microsoft.com/t5/azure-app-service/things-you-should-know-web-apps-and-linux/ba-p/392472#ContainerStart


  2. Balkrishna Agarwal 1 Reputation point
    2020-06-23T18:11:26.997+00:00

    Hey Sneha, Thanks for the answer but this doesn't work sadly.

    The same code is hosted at https://readbetterin.herokuapp.com/ it definitely doesn't take that long. All it takes is 1.92 secs. Something definitely seems to be wrong with the setup somewhere :|

    Here is the response on increasing the timeout to 1800 secs.

    502 - Web server received an invalid response while acting as a gateway or proxy server.
    There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
    

  3. Ryan Hill 27,026 Reputation points Microsoft Employee
    2020-06-24T04:08:33.443+00:00

    Hi @BalkrishnaAgarwal-6135,

    It looks like your app service wasn't able to bind itself to your nodejs app. I went to https://readbetterin.herokuapp.com and noticed it prints "Hello World". So what I did was

    npm init inside a hello_world

    add "start": "node index.js" to packages.json

    created index.js as follows

     var http = require('http')
        
     http.createServer(function (request, response) {
         response.writeHead(200, {"Content-Type": "text/plain"})
         response.end("Hello World\n")
     }).listen(process.env.PORT)
    

    From azure cli, ran az webapp up --name <appname> --resource-group <resource group> which defaulted to runtime 10.16. I went to the portal and updated to node|12-lts. az webapp up will do a zip deployment of the files which you can browse at https://readbetterinbyryan.azurewebsites.net. I also don't have 'Always On' enabled since I'm using the Free SKU which means if you hit the site when it's been idled, there will be short delay as the container starts up.

    Let me know if anything varies from what you've done.

    0 comments No comments

  4. Balkrishna Agarwal 1 Reputation point
    2020-06-25T18:02:03.207+00:00

    <p>Hey @ryanchill,</p>
    <p>Thanks for the effort & detailed answer. Sadly I dont understand the second part of your message (below). I understand its my ignorance as its the first time I am setting up something like this. Sadly the developers in my circle dont have experience with Azure. It would be great if somebody can get on a video call with me or make a video out of what needs to be done. I know I am asking for too much ::fingers_crossed::</p>
    <p>I didn't understand this bit.<br /> From azure cli, ran az webapp up --name <appname> --resource-group <resource group> which defaulted to runtime 10.16. I went to the portal and updated to node|12-lts. az webapp up will do a zip deployment of the files which you can browse at https://readbetterinbyryan.azurewebsites.net. I also don't have 'Always On' enabled since I'm using the Free SKU which means if you hit the site when it's been idled, there will be short delay as the container starts up.</p>
    <p>I think its because I dont have the Azure-CLI installed? I am trying to use the web interface by pushing & deploying code using github actions.</p>
    <br />


  5. Birendra Singh 181 Reputation points
    2021-04-15T05:35:09.537+00:00

    Some of the webpages not getting response from endpoint it might be SQL query f

    0 comments No comments