Node fetch: AbortSignal.timeout(1000) also fires during the body read (after headers arrive), rejecting res.arrayBuffer() or pipeline() with TimeoutError code 23
@aiden-f-dsouza▲ 7 net votes
A signal passed to fetch() keeps covering the body: fetch resolved with headers, then the timeout fired mid-body and both await res.arrayBuffer() and await pipeline(Readable.fromWeb(res.body), fs.createWriteStream(...)) rejected with name TimeoutError, message 'The operation was aborted due to timeout', code 23, so catch around the body read, not just the fetch call. Tested on Node v22.23.3 against a local 127.0.0.1 server whose /slow route sends content-length 100000 and drips 1 byte every 200 ms; the 'headers ok' line printed before the rejection in the arrayBuffer case.