question

AnupWadhwani-9734 avatar image
0 Votes"
AnupWadhwani-9734 asked SnehaAgrawal-MSFT commented

Nodejs Web App on Azure fails to run throwing Failed to forward request to application

2021-05-28T03:04:23.750475036Z Running hooks in /etc/ca-certificates/update.d...
2021-05-28T03:04:23.763278134Z done.
2021-05-28T03:04:23.792761648Z Updated CA certificates
2021-05-28T03:13:28.810538956Z [41m [30mfail [39m [22m [49m: Middleware[0]
2021-05-28T03:13:28.813422146Z Failed to forward request to application. Encountered a System.Threading.Tasks.TaskCanceledException exception after 300032.701ms with message: The operation was canceled.. Check application logs to verify the application is properly handling HTTP traffic.


I tried to debug but no help! it works perfectly fine in dev environment.

azure-webapps
· 5
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 asking question! Seems you've already enabled logging. Could you please share more details on app plan you are hosted Windows or Linux, If using docker and more of the log to help you better on this.

Refer to this article for Debug Node.js Web Apps on Azuredebug-node-js-web-apps-on-azure



0 Votes 0 ·

You may try below troubleshooting steps:

  • Access the log stream.

  • Test the app locally in production mode. App Service runs your Node.js apps in production mode, so you need to make sure that your project works as expected in production mode locally. For example:

  • Depending on your package.json, different packages may be installed for production mode (dependencies vs. devDependencies).

  • Certain web frameworks may deploy static files differently in production mode.

  • Certain web frameworks may use custom startup scripts when running in production mode.

  • Run your app in App Service in development mode.
    For example, in MEAN.js, you can set your app to development mode in runtime by setting the NODE_ENV app setting.

Let us know if issue remains.


0 Votes 0 ·

@SnehaAgrawal-MSFT thanks for the reply. app is hosted on linux without any docker. we tried to run app in local with prod mode it works fine. we have dev environment. its working without any issue in dev envrionment. but in QA which is hosted on west US server is giving us this error

0 Votes 0 ·
Show more comments

Just checking if you have chance to see below response. If this answers your query, do click “Accept Answer” and Up-Vote for the same. And, if you have any further query do let us know.

0 Votes 0 ·

1 Answer

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

Thanks for sharing screen shot. Below are the findings :

The Applications logs contain an error- Cannot find module '/home/site/wwwroot/dist/index.js'

The Application maybe missing a Node module which is causing your app to fail proper startup.

Suggest you to refer this article to deploy your app properly.

Further I can see that you are running on Basic SKU Consider running a production application on a Standard, Premium, or Isolated App Service Plan for better performance and isolation. These SKUs are best for production workloads, but there are other SKU options (Free, Shared, Basic) if you are still in testing mode.

Check: Azure App Service Plan Pricing Information


Also, your webapp is currently configured to run on two instances. Since you have only two instances you can expect a downtime of upto 50% because when the App Service platform is upgraded, the instance on which your web app is hosted will be upgraded. Therefore, your web app process will be restarted and may experience some downtime as each instance is restarted sequentially.
Consider Scaling out to three instances. These instances are in different upgrade domains and hence will not be upgraded at the same time. While one worker instance is getting upgraded the other is still active to serve web requests.

Check: Scale instance count manually or automatically

Hope this helps. Let us know if issue remains.



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.