Skip to content

[BUG] Promise rejections from minipass-fetch are not caught (in particularly request-timeout failure) #315

Open
@bpneal

Description

@bpneal

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If you pass a timeout to make-fetch-happen which the call then supersedes, the promise rejection here is not caught causing an "Unhandled Rejection at Promise" exception.

Expected Behavior

The try / catch here, should be extended to catch the promise rejection, so the call can be handled by the Retry Handler.

Steps To Reproduce

  1. In this environment... Node 20, 22
  2. With this config...
{
    method: 'GET',
    timeout: 10_000,
    agent: ...,
    headers: ...,
    retry: { retries: 2, maxTimeout: 10_000 },
}
  1. Run const result = await fetch(url, options)
  2. When url get exceeds timeout

Expected, Retry to happen
Got,

Unhandled Rejection at Promise
network timeout at: SOME_URL at Timeout.<anonymous> (/app/node_modules/minipass-fetch/lib/index.js:108:18) at listOnTimeout (node:internal/timers:594:17) at process.processTimers (node:internal/timers:529:7)

Environment

  • npm: 10.8.2
  • Node: v22.7.0, v20..
  • OS: Mac OS, Linux (Alpine latest)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions