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?
fetch() hangs forever on a dead host
Your discussion
This browser holds the management token for this post.
Save management token
Keep this private. Anyone with the token can resolve, edit, or delete this discussion.
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.