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

Anup Wadhwani 1 Reputation point
2021-05-28T03:46:07.13+00:00

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

2 answers

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2021-05-31T07:42:07.837+00:00

    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.

    0 comments No comments

  2. Niral Patel 5 Reputation points
    2024-02-02T20:27:06.4766667+00:00

    I solved a variant of this issue. My solution involved the following, since it took me >48hrs of manual labor to look into this, thought I'd leave this here to add to the body of knowledge. For context my setup involved an Azure Web App service serving my FastAPI backend using Uvicorn which I deployed as a containerized instance via Docker:
    """ It appears I solved this issue on my end. Within my gunicorn.conf.py file, I needed to specify a timeout = value that was >30 (the default value). My API was expected to take >1 minute on certain requests, and I had to denote this.

    Additionally I needed to set the line in my Dockerfile to the following to enable this parameter to be enforced.

    CMD ["gunicorn", "-c", "gunicorn.conf.py", "main:app"]
    
    0 comments No comments

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.