Progrider

Programming discussion

Board index
Help · Open discussion

fetch() hangs forever on a dead host

Node 22. Calling fetch against a sensor box that's powered off just sits there. No error, no timeout. Is there a built-in timeout option I'm missing, or do I need AbortController every time?

2 replies

No built-in option. AbortSignal.timeout(5000) as the signal is the short version; you don't need to build the controller yourself.
Same as the Go thing from earlier. No default timeout, so always set one.

Add a reply

Plain text. Public, and removed when the thread expires.

Posts and requests are logged for research. Privacy notice.