nodejs / nodejs/undici

fetch fail: cause: AggregateError [ETIMEDOUT]:

Open
#2,777 31 comments 15 reactions 0 assignees View on GitHub

@gregonarash is already working on this.

Since Oct 15, 2024.

  • #3738 by @gregonarash — open
bug
Dominant language
JavaScript
Stars
7.7k
Forks
880
Avg merge
2d 16h
Merged PRs (30d)
68

Description

Bug Description

my code is typescript. I run it in two ways:

  1. use bun
  2. compile to js, and use node v21

when use bun run it, no error occurs;
when use node run it, it occurs fetch failed extremely frequent

the request is an apollo graphql request.
proxy is local http proxy:

https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

Logs & Screenshots

ApolloError: fetch failed
    at new ApolloError (/Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/@apollo/client/errors/errors.cjs:33:28)
    at /Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/@apollo/client/core/core.cjs:2017:78
    at both (/Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/@apollo/client/utilities/utilities.cjs:1347:31)
    at /Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/@apollo/client/utilities/utilities.cjs:1338:72
    at new Promise (<anonymous>)
    at Object.then (/Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/@apollo/client/utilities/utilities.cjs:1338:24)
    at Object.error (/Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/@apollo/client/utilities/utilities.cjs:1349:49)
    at notifySubscription (/Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/zen-observable/lib/Observable.js:140:18)
    at onNotify (/Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/zen-observable/lib/Observable.js:179:3)
    at SubscriptionObserver.error (/Users/guotie/guotie/product/ZUGGER/poolapi/node_modules/zen-observable/lib/Observable.js:240:7) {
  graphQLErrors: [],
  protocolErrors: [],
  clientErrors: [],
  networkError: TypeError: fetch failed
      at node:internal/deps/undici/undici:12442:11
      at processTicksAndRejections (node:internal/process/task_queues:95:5)
      at runNextTicks (node:internal/process/task_queues:64:3)
      at listOnTimeout (node:internal/timers:540:9)
      at process.processTimers (node:internal/timers:514:7) {
    cause: AggregateError [ETIMEDOUT]: 
        at internalConnectMultiple (node:net:1116:18)
        at internalConnectMultiple (node:net:1184:5)
        at Timeout.internalConnectMultipleTimeout (node:net:1707:5)
        at listOnTimeout (node:internal/timers:575:11)
        at process.processTimers (node:internal/timers:514:7) {
      code: 'ETIMEDOUT',
      [errors]: [Array]
    }
  },
  extraInfo: undefined
}

Environment

Mac M1 Sonoma 14.2

Nodejs v21

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Node v21 fetch stack at node:internal/deps/undici/undici and the reported Apollo GraphQL request, reproducing it with the listed HTTP and SOCKS proxy environment variables. Compare Node and Bun on the reported macOS environment and inspect the ETIMEDOUT AggregateError. Done means the failure cause is isolated and covered by an appropriate regression test or documented limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.