Debugging "H18 Server request interrupted" errors in NodeJS applications

Issue

You're getting the H18 - Server request interrupted errors in your NodeJS applications logging and metrics.

Resolution

The H18 error is similar to the H13 in that both signify that the socket was destroyed before a response was completed. With an H13, the socket was connected, then destroyed without sending any data. An H18 signifies that the socket connected, some data was sent as part of a response by the app, but then the socket was destroyed without completing the response.

Usually, an H18 indicates that a response has multiple stages - for instance, streaming chunks of a large response - and that one of those stages has thrown an error.

To find the error, first check your logs for stack traces near the H18. If you see none, you'll need to look more closely at the handlers for the specific request that's failing. Logging each step of the response, including the x-request-id header, can help.

You can also find more information in this article : https://devcenter.heroku.com/articles/error-codes#h18-server-request-interrupted

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support