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

Global fetch produces unhelpful Error for ENOTFOUND #42804

Closed
kevinoid opened this issue Apr 20, 2022 · 4 comments · Fixed by nodejs/undici#1353
Closed

Global fetch produces unhelpful Error for ENOTFOUND #42804

kevinoid opened this issue Apr 20, 2022 · 4 comments · Fixed by nodejs/undici#1353
Labels
fetch Issues and PRs related to the Fetch API

Comments

@kevinoid
Copy link
Contributor

kevinoid commented Apr 20, 2022

Version

v18.0.0

Platform

Linux kevinolos 5.18.0-rc3 #197 SMP PREEMPT_DYNAMIC Mon Apr 18 07:08:40 MDT 2022 x86_64 GNU/Linux

Subsystem

http

What steps will reproduce the bug?

Run node -e "fetch('http://invalid')"

How often does it reproduce? Is there a required condition?

100% reliable.

What is the expected behavior?

A helpful error, such as the one produced by undici:

Error: getaddrinfo ENOTFOUND invalid.
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:71:26) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'invalid'
}

What do you see instead?

An error indicating that fetch failed with a cause of Error: [object Object]:

TypeError: fetch failed
    at Object.processResponse (node:internal/deps/undici/undici:7188:34)
    at node:internal/deps/undici/undici:7516:42
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:202:9)
    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: [object Object]
      at makeNetworkError (node:internal/deps/undici/undici:6317:51)
      at httpNetworkFetch (node:internal/deps/undici/undici:7810:16)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async httpNetworkOrCacheFetch (node:internal/deps/undici/undici:7703:33)
      at async httpFetch (node:internal/deps/undici/undici:7557:37)
      at async schemeFetch (node:internal/deps/undici/undici:7489:18)
      at async node:internal/deps/undici/undici:7342:20
      at async mainFetch (node:internal/deps/undici/undici:7338:20) {
    [cause]: undefined
  }
}

Additional information

No response

@VoltrexKeyva VoltrexKeyva added the fetch Issues and PRs related to the Fetch API label Apr 21, 2022
@meixg
Copy link
Member

meixg commented Apr 21, 2022

This seems to be a bug of undici, I tried on the same code on the undici master branch and get the same output.

@meixg
Copy link
Member

meixg commented Apr 21, 2022

reopen as we need to update undici

@meixg meixg reopened this Apr 21, 2022
@zadmarbella
Copy link

zadmarbella commented Apr 25, 2022

Seeing this error also. update to what version? does anyone know the cause? @meixg

@mcollina
Copy link
Member

mcollina commented May 4, 2022

This was fixed in #42939

@mcollina mcollina closed this as completed May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetch Issues and PRs related to the Fetch API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants