The line where fetch is called doesn't show in the stack trace
See original GitHub issueVersion
v18.7.0
Platform
Linux 98a94d978874 5.4.0-122-generic nodejs/node#138~18.04.1-Ubuntu SMP Fri Jun 24 14:14:03 UTC 2022 x86_64 Linux
Subsystem
fetch
What steps will reproduce the bug?
async function a() {
await fetch('http://a.com')
}
(async function() {
await a()
// → 🎉
}());
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
At some point in the stack frame:
at a (/home/user/projectA/a.js:8:11)
What do you see instead?
TypeError: fetch failed
at Object.processResponse (node:internal/deps/undici/undici:7175:34)
at Fetch.fetchFinale (node:internal/deps/undici/undici:7505:21)
at Fetch.mainFetch (node:internal/deps/undici/undici:7399:21)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
cause: Error: getaddrinfo ENOTFOUND a.com
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:82:26) {
errno: -3008,
code: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'a.com'
}
}
Additional information
Maybe undici issue @mcollina ?
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Why do fetch errors not have a stacktrace in my single page ...
The problem is that network errors from fetch, caught in fetchArticles, do not contain a stack trace. So error.stack does not exist. Which...
Read more >718760 - Show line number of fetch call in error stack trace
The error.stack in the above example doesn't show any line numbers, which seems a bit odd. Unless I'm misunderstanding, it should at least...
Read more >traceback — Print or retrieve a stack traceback — Python 3.11 ...
The line is a string with leading and trailing whitespace stripped; if the source is not available it is None . traceback.extract_stack(f= ...
Read more >Stack trace not showing correct line number - Google Groups
The problem is that the trace always gives us the first line of the method and not the line where the exception is...
Read more >Analyze a stack trace - Android Developers
A stack trace shows a list of method calls that lead to the exception being thrown, together with the filenames and line numbers...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t think it would. This will get us there:
I’m not sure the exact implications of this.
cc @benjamingr
@sosoba would you like to send a PR to implement this?