Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
bpneal opened this issue Sep 16, 2024 · 1 comment
Labels
Needs Triage needs an initial review

Comments

@bpneal
Copy link

bpneal commented Sep 16, 2024

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)
@bpneal bpneal added the Needs Triage needs an initial review label Sep 16, 2024
@bpneal
Copy link
Author

bpneal commented Sep 16, 2024

Maybe, the catch here should return for times outs rather than throwing https://github.com/npm/make-fetch-happen/blob/main/lib/remote.js#L123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Triage needs an initial review
Projects
None yet
Development

No branches or pull requests

1 participant