question

BalkrishnaAgarwal-6135 avatar image
0 Votes"
BalkrishnaAgarwal-6135 asked BIRENDRA answered

Nodejs application times out

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-webapps
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SnehaAgrawal-MSFT avatar image
0 Votes"
SnehaAgrawal-MSFT answered SnehaAgrawal-MSFT commented

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://docs.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



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@BalkrishnaAgarwal-6135 Just checking if you have chance to see previous response.
If the above answer was helpful, kindly do ‘Accept as answer” and/or ‘Vote as helpful’ the post for benefiting the other users with a similar issue.

0 Votes 0 ·
BalkrishnaAgarwal-6135 avatar image
0 Votes"
BalkrishnaAgarwal-6135 answered BalkrishnaAgarwal-6135 edited

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.
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I would also like to point out that though I set the WEBSITES_CONTAINER_START_TIME_LIMIT as 1800 in app settings, it timeouts in 230secs.

PS: Yes, I saved the settings & restarted the app.

0 Votes 0 ·
ryanchill avatar image
0 Votes"
ryanchill answered ryanchill edited

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.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

BalkrishnaAgarwal-6135 avatar image
0 Votes"
BalkrishnaAgarwal-6135 answered BalkrishnaAgarwal-6135 commented

<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 />


· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for reaching here! Request you to send us email to AzCommunity[at]Microsoft[dot]com referencing this thread, we would like to work closer with you on this matter.

1 Vote 1 ·

Did it. Thanks 🙂

0 Votes 0 ·
BIRENDRA avatar image
0 Votes"
BIRENDRA answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.