Next.js Discord

Discord Forum

Extend fetch timeout to more than 5 minutes.

Unanswered
Brokenwind posted this in #help-forum
Open in Discord
How do I extend fetch's timeout to be more than 5 minutes?

I have an API that takes more than that to process. If it waits for more than 5 minutes it gives out
[cause]: HeadersTimeoutError: Headers Timeout Error

I checked that this is something bound to Node.js because of undici setting it to 5 minutes (chrome's own timeout I think).

Is there a way in Next to deal with this?

3 Replies

@B33fb0n3 > Is there a way in Next to deal with this? yes, take a look *why* it takes so long to resolve your request. Then find other solutions for that. I wish I could provide your something better, but for that I need more context, code, ...
It's a business process that really takes a long time (that's why I'm even running an external backend). So limiting the time of that process isn't really the solution here. Node's limit suck and I wish we have a way to config that directly from Next.