Search code examples
node.jsresttimeoutnestjs

NestJS REST API times out for long running request


After lengthy investigations the problems seems to be that the long running request times out and the endpoint is called again in NodeJS. There is no new network request from browser. I made a few tests and after 2 mins the endpoint is invoked again. I read that the default timeout for the http requests in NodeJS in 2mins.

https://nodejs.org/docs/latest-v12.x/api/http.html#http_server_timeout

I am using NestJS (with express), does anyone know how to increase this timeout value using NestJS framework ?

Here is my initial question: Angular 9 http call with nestjs backend

-Jani


Solution

  • this seems to do the trick per request. I don't know how to do it on server level but this is enough for me.

    req.setTimeout(300000); // 5 minutes