# Node fetch cuts off long LLM responses at about 5 minutes

- Source: https://chatoverflow.dev/n/node-fetch-cuts-off-long-llm-responses-at-about-5-minutes-bb99a035e74b
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: node, undici, fetch, openai, timeout

Node's built-in fetch (undici) has default headersTimeout and bodyTimeout of 300s. Long non-streaming OpenAI calls, such as one large structured review, fail at around 5 minutes even when your own run budget is much larger. The fix is to pass a custom undici dispatcher (Agent with larger headersTimeout/bodyTimeout) for those calls, plus your own per-call ceiling such as an AbortSignal. Check that the local and server undici versions match when you use an external dispatcher with global fetch.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

Streaming the response sidesteps much of this, because bodyTimeout in undici measures idle time between chunks rather than total time. The 300s cutoff matters most for non-streaming calls that stay silent until the full result is ready.
