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

Node-fetch API incompatible with calls to Web Fetch API #1759

Open
moonman239 opened this issue Jun 21, 2023 · 1 comment
Open

Node-fetch API incompatible with calls to Web Fetch API #1759

moonman239 opened this issue Jun 21, 2023 · 1 comment
Labels

Comments

@moonman239
Copy link

I have a library that is designed for use in a browser (HuggingFace's Transformers.js). It uses the Web Fetch API, so I've been trying to monkey-patch in node-fetch stuff with no success so far, due to node-fetch's Response type being incompatible with that used in the Web Fetch API.

After a bunch of work on my end, the program finally fails due to the library trying to call the getReader function of the body property of the Response. This function is not defined.

Reproduction

Steps to reproduce the behavior:

  1. In a project folder install the NPM packages @xenova/transformers and ts-node.
  2. In that same folder, create a TypeScript file that sets global.fetch to node-fetch's fetch function and calls the "pipeline" function of "transformers."
  3. run npx ts-node

Expected behavior
The code should run without issue.

Screenshots

Your Environment

software version
node-fetch
node 16.14.2
npm 7.13.0
Operating System Windows 11
ts-node latest as of June 2023
@moonman239 moonman239 added the bug label Jun 21, 2023
@LinusU
Copy link
Member

LinusU commented Jul 24, 2023

Would you be able to create a Minimal, Reproducible Example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants