From 21e4377de2a72d338665bf56bdf3e459e74b49b8 Mon Sep 17 00:00:00 2001 From: Aldmar Joubert Date: Mon, 20 Feb 2023 14:19:20 -0600 Subject: [PATCH] added npm version conflict section and moved http 5xx status table to above troubleshooting 5XXs --- ...7-troubleshooting-common-iisnode-issues.md | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/_posts/2022-10-17-troubleshooting-common-iisnode-issues.md b/_posts/2022-10-17-troubleshooting-common-iisnode-issues.md index 36d2ba92..12bddd9c 100644 --- a/_posts/2022-10-17-troubleshooting-common-iisnode-issues.md +++ b/_posts/2022-10-17-troubleshooting-common-iisnode-issues.md @@ -101,24 +101,6 @@ The below screenshot shows how to enable application logging through the portal. ![Kudu Debug Console - view freb logs](/media/2022/08/failed-request-log-sample.png) -# IISNODE http status and substatus - -The below table is referenced from: - -https://docs.microsoft.com/en-us/azure/app-service/app-service-web-nodejs-best-practices-and-troubleshoot-guide#iisnode-http-status-and-substatus - -| HTTP Status | HTTP Substatus | Possible reason? | -|-------------|----------------|------------------| -| 500 | 1000 | There was some issue dispatching the request to IISNODE – Check if node.exe was started. Node.exe could have crashed when starting. Check your web.config configuration for errors. | -| 500 | 1001 | - Win32Error 0x2 - App is not responding to the URL. Check the URL rewrite rules or check if your express app has the correct routes defined. - Win32Error 0x6d – named pipe is busy – Node.exe is not accepting requests because the pipe is busy. Check high cpu usage. - Other errors – check if node.exe crashed. | -| 500 | 1002 | Node.exe crashed – check d:\home\LogFiles\logging-errors.txt for stack trace. | -| 500 | 1003 | Pipe configuration Issue – The named pipe configuration is incorrect. | -| 500 | 1004-1018 | There was some error while sending the request or processing the response to/from node.exe. Check if node.exe crashed. check d:\home\LogFiles\logging-errors.txt for stack trace. | -| 503 | 1000 | Not enough memory to allocate more named pipe connections. Check why your app is consuming so much memory. Check maxConcurrentRequestsPerProcess setting value. If it's not infinite and you have many requests, increase this value to prevent this error. | -| 503 | 1001 | Request could not be dispatched to node.exe because the application is recycling. After the application has recycled, requests should be served normally. | -| 503 | 1002 | Check win32 error code for actual reason – Request could not be dispatched to a node.exe. | -| 503 | 1003 | Named pipe is too Busy – Verify if node.exe is consuming excessive CPU. | - # Troubleshooting Common Issues ## Hard coding the PORT @@ -189,6 +171,38 @@ An example of an updated package.json start script file using PM2. Replace .bin/ ``` To validate CPU usage, you can review the detectors under the App Service [Diagnose and Solve Problems](https://learn.microsoft.com/en-us/azure/app-service/overview-diagnostics) blade. +## NPM version conflict + +If you run into an issue where you believe the conflict is due to the NPM version, you can test by updating the NPM version using the application setting WEBSITE_NPM_DEFAULT_VERSION=desired-version. + +To validate the NPM version being used, you can run the below command within the SCM site debug console found here: webapp-name.scm.azurewebsites.net/DebugConsole + +```sh +npm --version +``` + +To validate which versions of NPM are installed on your App Service plan, you can browse your application's SCM site and review the runtime versions here: webapp-name.scm.azurewebsites.net/api/diagnostics/runtime + +Testing the behaviour locally to validate a conflict with a specific NPM version is best. + +# IISNODE http status and substatus + +The below table is referenced from: + +https://docs.microsoft.com/en-us/azure/app-service/app-service-web-nodejs-best-practices-and-troubleshoot-guide#iisnode-http-status-and-substatus + +| HTTP Status | HTTP Substatus | Possible reason? | +|-------------|----------------|------------------| +| 500 | 1000 | There was some issue dispatching the request to IISNODE – Check if node.exe was started. Node.exe could have crashed when starting. Check your web.config configuration for errors. | +| 500 | 1001 | - Win32Error 0x2 - App is not responding to the URL. Check the URL rewrite rules or check if your express app has the correct routes defined. - Win32Error 0x6d – named pipe is busy – Node.exe is not accepting requests because the pipe is busy. Check high cpu usage. - Other errors – check if node.exe crashed. | +| 500 | 1002 | Node.exe crashed – check d:\home\LogFiles\logging-errors.txt for stack trace. | +| 500 | 1003 | Pipe configuration Issue – The named pipe configuration is incorrect. | +| 500 | 1004-1018 | There was some error while sending the request or processing the response to/from node.exe. Check if node.exe crashed. check d:\home\LogFiles\logging-errors.txt for stack trace. | +| 503 | 1000 | Not enough memory to allocate more named pipe connections. Check why your app is consuming so much memory. Check maxConcurrentRequestsPerProcess setting value. If it's not infinite and you have many requests, increase this value to prevent this error. | +| 503 | 1001 | Request could not be dispatched to node.exe because the application is recycling. After the application has recycled, requests should be served normally. | +| 503 | 1002 | Check win32 error code for actual reason – Request could not be dispatched to a node.exe. | +| 503 | 1003 | Named pipe is too Busy – Verify if node.exe is consuming excessive CPU. | + # Troubleshooting 5xx Server Errors If your application is returning a **HTTP 500 error**, the next place to look is the detailed errors within the **/home/LogFiles** directory. This will give you the **substatus code** and **win32 error code**, which can be used to help isolate the issue further. An example of the detailed error output can be observed in the next section.