A. Werner
A. Werner

Reputation: 405

Why is Azure giving me random 500 errors?

I've built a Node.js web application and deployed it as an Azure web app. The web app basically gets data from an Azure storage account and displays it to the client. Very simple.

Sometimes it can take a while for the data to get back to the client. So I'm using promises to handle the asynchronous nature of this issue.

On a development server, there are no problems. The data always makes it back to the client. (Tested on Internet Explorer, Chrome, and Firefox)

However, in the Azure web app, sometimes the data makes it back to the client, and sometimes the request fails (always after 5 seconds), and the client can see a 500 (internal server) error in the browser's developer tools.

Now even though the client receives a 500 error, the azure log stream shows no problems, and the server continues working like a problem never occurred.

This web app is built with a free tier service plan which uses shared resources. Is this the problem or has anyone had any experience with this problem in Azure?

Upvotes: 0

Views: 2675

Answers (2)

A. Werner
A. Werner

Reputation: 405

Asked the same question on the Microsoft forum:

https://social.msdn.microsoft.com/Forums/en-US/a89e8cec-15d6-4a3b-b54d-17f6092ead77/webhcat-post-request-from-web-app-cause-500-error?forum=windowsazurewebsitespreview

Turns out it was an issue with Azure and not my code. My site is now working.

Upvotes: 0

Aaron Chen
Aaron Chen

Reputation: 9950

For 500 error, you'll need to enable logging of stdout and stderr for troubleshooting and see what the logs say. To enable debugging, you can either modify your web.config or create/modify an iisnode.yml file at the root of your Node.js application.

In the web.config, it looks like this:

<iisnode loggingEnabled="true" logDirectory="iisnode" />

Or in iisnode.yml, it looks like this:

loggingEnabled: true
logDirectory: iisnode

Now, you can view the logs by going to https://{yoursitename}.scm.azurewebsites.net/api/vfs/site/wwwroot/iisnode/index.html in the browser.

enter image description here

You can also check out these instructions on debugging Node.js in Azure Web App: How to debug a Node.js web app in Azure App Service.

Upvotes: 1

Related Questions