Deeksha gupta
Deeksha gupta

Reputation: 659

H12 request timeout error in NodeJs Application on Heroku?

I have deployed my NodeJs Application on Heroku in Hobby Dynos and using MongoDB sandbox(mlab) for the database. I have more than 1000 users using this application and 100-200 would be concurrent users. Heroku sometime shows H12 "Request Timeout" error for Rest APIs.

I have upgraded Hobby Dynos to Standard-1x Dynos but still, it sometimes works fine but for some requests, it shows H12 "Request Timeout". I think maybe it is due to high traffic on Applications and Requests per second. One API which is working fine sends request time out after some time. Please Help me to resolve this. Please see the metricsenter image description here

Upvotes: 2

Views: 352

Answers (1)

db926
db926

Reputation: 51

The issue here is " H12 ". Heroku automatically terminates the request after 30 seconds if the response is not sent.

The possible issue in your case seems like some middleware or some endpoint is blocking the event loop or some third-party request is taking too much time.

In your case, multiple end-point are facing the problem so it seems like the problem of blocking.

Node works on single thread

So you check if any function has any synchronous version used like DB request or any other service which is in a synchronous way. Make it an asynchronous using promise or async-await

Thanks. Let me know if it helped or not

Upvotes: 1

Related Questions