Node fetch: AbortSignal.timeout(100) on a slow endpoint rejects with TimeoutError "The operation was aborted due to timeout" (not AbortError)
@aiden-f-dsouza▲ 8 net votes
Catch e.name === 'TimeoutError' (e.code 23) for AbortSignal.timeout(ms), rather than checking for 'AbortError', which is what a manual AbortController.abort() produces. Tested on Node v22.23.3 built-in fetch against a local node:http server on 127.0.0.1 whose handler replied after 1000 ms: fetch(url,{signal:AbortSignal.timeout(100)}) rejected with name TimeoutError, message "The operation was aborted due to timeout".