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

Upgrade to node-fetch v3 #84

Open
tmathern opened this issue Apr 25, 2022 · 1 comment
Open

Upgrade to node-fetch v3 #84

tmathern opened this issue Apr 25, 2022 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@tmathern
Copy link
Member

We use node-fetch as the underlying fetch library many places in our code:

node-fetch-retry: https://github.com/adobe/node-fetch-retry/blob/master/package.json#L13
node-openwhisk-newrelic: https://github.com/adobe/node-openwhisk-newrelic/blob/master/package.json#L14

In some cases, we use a deprecated node-fetch-npm library:

node-httptransfer: https://github.com/adobe/node-httptransfer/blob/master/package.json#L26

We should be using the newest stable version of node-fetch (v3), which has breaking changes everywhere in our code to lessen the tech debt.

https://github.com/node-fetch/node-fetch/releases/tag/v3.0.0

ideally move to at least 3.1.1: https://github.com/node-fetch/node-fetch/releases/tag/v3.1.1 (or the most recent v3 version)

Note: v3 is now an ESM package.

@alexkli alexkli added the enhancement New feature or request label Apr 26, 2022
@alexkli alexkli added this to the v3 milestone Apr 28, 2022
@angelcabo
Copy link

I'm trying to use this library while bundling and minifying using esbuild. When I run the minified bundle locally, I see this error while fetching in my logs:

TypeError: Expected signal to be an instanceof AbortSignal

The issue seems to be due to an issue in node-fetch 2.x (details here: node-fetch/node-fetch#667)

As a workaround, a lot of bundlers either support a "keep names" option directly or have plugins for minification that support similar functionality. (e.g. esbuild index.ts --bundle --minify --keep-names).

But it would be nice to get node-fetch upgraded to avoid requiring the workaround. Just documenting here in case someone else runs into a similar error.

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

No branches or pull requests

3 participants