Tagged: fetch
Nodejs
TypeError: fetch failed — cause: ECONNRESET (Node.js built-in fetch/undici)
Node's built-in `fetch` (powered by undici) throws a generic `TypeError: fetch failed` and buries the actual reason inside `error.cause`. Log `error.cause` to see the real network error (ECONNRESET, ETIMEDOUT, a TLS certificate error, etc.) instead of debugging the wrapper message alone.
Draft·
NodejsError: The operation was aborted due to timeout (AbortSignal.timeout / TimeoutError)
AbortSignal.timeout(ms) fires an abort after the given duration, which surfaces wherever the signal was passed — most commonly into fetch() — as a TimeoutError (a DOMException). Catch it specifically and check `error.name === 'TimeoutError'` to distinguish it from other abort reasons or network failures.
Draft·