Skip to content

request throws AbortError rather than TimeoutError when passed AbortSignal.timeout(1000) as signal #2590

@ShenHongFei

Description

@ShenHongFei

Bug Description

AbortError: Request aborted
    at abort (file:///D:/0/lib/deps.bundle.js:19008:18)
    at self.<computed> (file:///D:/0/lib/deps.bundle.js:19027:5)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:822:20)
    at EventTarget.dispatchEvent (node:internal/event_target:757:26)
    at abortSignal (node:internal/abort_controller:374:10)
    at Timeout._onTimeout (node:internal/abort_controller:128:7)
    at listOnTimeout (node:internal/timers:573:17)
    at process.processTimers (node:internal/timers:514:7)

Reproducible By

import { request } from 'undici'

await request('http://localhost', { signal: AbortSignal.timeout(1000) })

Expected Behavior

TimeoutError: xxx

Logs & Screenshots

image

Environment

latest node.js
latest windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions