You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expecting fetch to be compatible with the original Node.js fetch API.
Actual Behavior
The node-fetch module (https://www.npmjs.com/package/node-fetch) overwrites the global fetch module and is incompatible, causing the following error in all underlying imported modules using fetch.
TypeError: res.body.getReaderisnotafunction
Steps to Reproduce the Problem
importbfetchfrom'node-fetch';// error getReaderasyncfunctionnodefetchExample(){constresponse=awaitbfetch('https://google.com');constreader=awaitresponse.body.getReader();}nodefetchExample().catch(error=>console.error(error));// no error in original fetchasyncfunctionfetchExample(){constresponse=awaitfetch('https://google.com');constreader=awaitresponse.body.getReader();}fetchExample().catch(error=>console.error(error));
Do not replace or overwrite the global fetch module with node-fetch if it is already present.
This will also supports the proposed AbortController #527
Specifications
Version: 7.2.3
Platform: Node v20.6.1
The text was updated successfully, but these errors were encountered:
Expected Behavior
Expecting
fetch
to be compatible with the original Node.jsfetch
API.Actual Behavior
The
node-fetch
module (https://www.npmjs.com/package/node-fetch) overwrites the globalfetch
module and is incompatible, causing the following error in all underlying imported modules using fetch.Steps to Reproduce the Problem
https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader
Solution:
Do not replace or overwrite the global
fetch
module withnode-fetch
if it is already present.This will also supports the proposed AbortController #527
Specifications
The text was updated successfully, but these errors were encountered: