npm / minipass-fetch

An implementation of window.fetch in Node.js using Minipass streams
Other
54 stars 11 forks source link

[BUG] Max timeout cannot be increased #16

Closed raineorshine closed 1 year ago

raineorshine commented 3 years ago

What / Why

The timeout option can shorten the timeout (e.g. timeout: 1000) but cannot increase the timeout beyond the default (e.g. timeout: 180000).

It would be helpful to be able to increase the timeout for slow internet connections.

When

Setting timeout to greater than 60000.

How

Current Behavior

Steps to Reproduce

const fetch = require('minipass-fetch')
fetch('https://example.com:1234', { timeout: 180000 })
  .then(res => res.text())
  .then(body => console.log(body))

Expected Behavior

timeout should support values greater than 60000 and not time out earlier.

Who

References

yogeshgadge commented 1 year ago

I wonder if my issue is related to this:- I have tried many things like maxsockets, retry max/min timeouts but to no avail.

[error] FetchError: request to https://REDACTED/artifactory/api/npm/npm/eslint failed, reason: Socket timeout
    at ClientRequest.<anonymous> (/Users/REDACTED/projects/my-proj-ng14/node_modules/minipass-fetch/lib/index.js:130:14)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:502:9)
    at TLSSocket.emit (node:events:525:35)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)