Node v20.12.x TypeError: fetch is not a function
mkilpatrick opened this issue · 3 comments
mkilpatrick commented
Version
v20.12.2
Platform
Darwin mkilpatrick-mbp 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64
Subsystem
No response
What steps will reproduce the bug?
Using fetch
is broken in Node v20.12.x. It works in v20.11.x.
How often does it reproduce? Is there a required condition?
No response
What is the expected behavior? Why is that the expected behavior?
No response
What do you see instead?
Using fetch results in TypeError: fetch is not a function
Additional information
No response
VoltrexKeyva commented
Can't reproduce, can't do much here without seeing your code that uses the function.
tchetwin commented
There's something stirring with fetch
and v20.12.x
:
- https://stackoverflow.com/questions/78304233/typeerror-cannot-assign-to-read-only-property-fetch-of-object-object-global
- This points to Jest 29.7.0 as resolving, not sure what from the CHANGELOG
- replicate/replicate-javascript#237
- sinonjs/sinon#2590
- Real-Dev-Squad/website-backend#2011
Edit: this ships in Node 20.12.0: #51598 and does not define writable
for fetch
, implying it will be false
:
joyeecheung commented
I think this will be fixed by #52275