undici
undici copied to clipboard
Cannot read properties of undefined (reading 'timeoutType')
/home/obziappdev/wheat/node_modules/undici/lib/client.js:1167
if (socket[kParser].timeoutType !== TIMEOUT_IDLE) {
^
TypeError: Cannot read properties of undefined (reading 'timeoutType')
at _resume (/home/obziappdev/wheat/node_modules/undici/lib/client.js:1167:29)
at resume (/home/obziappdev/wheat/node_modules/undici/lib/client.js:1131:3)
at connect (/home/obziappdev/wheat/node_modules/undici/lib/client.js:1116:3)
When i Started my Discordjs bot it caused this
nodejs: 16.17.0
What version of undici?
Thanks for reporting!
Can you provide steps to reproduce? We often need a reproducible example, e.g. some code that allows someone else to recreate your problem by just copying and pasting it. If it involves more than a couple of different file, create a new repository on GitHub and add a link to that.
I'm also experiencing this same exception.
Of note, my scenario is is all TypeScript running as ESM but wrapped in Jest tests, executing through ts-jest... so not uncomplicated... but it does it on any call pattern, including just a simple get through the fetch
method...
Sorry, this is going to be a shorter just "more info" comment at the moment...
node.js: 18.9.0 undici: 5.10.0 typescript: 4.8.3 jest: 28.1.3 ts-jest: 28.0.8
The underlying error is masked:
{
"cause": {
"message": "Cannot destructure property 'exports' of 'undefined' as it is undefined.",
"stack": "TypeError: Cannot destructure property 'exports' of 'undefined' as it is undefined.\n at new Parser (/node_modules/undici/lib/client.js:405:34)\n at connect (/node_modules/undici/lib/client.js:1062:23)"
},
"message": "fetch failed",
"stack": "TypeError: fetch failed\n at Object.processResponse (/node_modules/undici/lib/fetch/index.js:199:23)\n at /node_modules/undici/lib/fetch/index.js:928:38\n at node:internal/process/task_queues:140:7\n at AsyncResource.runInAsyncScope (node:async_hooks:203:9)\n at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)"
}
This is the llhttpInstance
variable that is undefined... and it's undefined because the llhttpPromise
is returning undefined at line 1047 of client.js... which is "fullfilled' by lazyllhttp
line 324, but on the first line of the method 325, it checks a JEST_WORKER_ID environment variable and requires require('./llhttp/llhttp.wasm.js')
which is Web Assembly... and that does something that causes the runtime to do something odd when debugging where it doesn't advance but returns and have not dug into that...
A reproducible example was provided in https://github.com/nodejs/node/issues/45168#issuecomment-1294277796