Skip to content

confusing error message 'network timeout' if retryMaxDuration is hit #81

@alexkli

Description

@alexkli

Observed behavior

If retryMaxDuration is reached, you get this error thrown (code here):

FetchError: network timeout at https://example.com/some/url
    at wrappedFetch (/some/filesystem/folder/myproject/node_modules/@adobe/node-fetch-retry/index.js:245:20)
    at runMicrotasks (<anonymous>)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:497:9) {
  type: 'request-timeout'
}

This is confusing, because:

  1. it's not directly a network timeout
  2. it does not mention the time that has passed (and the retryMaxDuration)
  3. and it misses the original/last error message of the actual request (in my case I am sure there must have been any since retryMaxDuration was 60 sec, and socketTimeout 30 sec)

Expected behavior

Change error message to something like this:

FetchError: retries reached max duration of 60 sec for https://example.com/some/url, last error: ECONNRESET

More details

What's also interesting is that before that error I ONLY see maximum of 1 retry attempt before, with short initial retry delay:

AbortError failed with type: aborted; message: The user aborted a request.
Retrying in 107 milliseconds, attempt 1 error: AbortError, The user aborted a request.
AbortError failed with type: aborted; message: The user aborted a request.
Retrying in 182 milliseconds, attempt 1 error: AbortError, The user aborted a request.

I would have expected to see something like Retrying in 30000 milliseconds, attempt 5 or similar before running into the retryMaxDuration limit.

There are many of those messages in the log output as my application makes many requests at the same time which all ran into some network limits at around the same time. They all have just log 1 retry attempt and then presumably work fine, except the one that failed.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions