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

Updating node-fetch to v3 #32

Open
larsgw opened this issue Sep 18, 2022 · 8 comments
Open

Updating node-fetch to v3 #32

larsgw opened this issue Sep 18, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@larsgw
Copy link
Owner

larsgw commented Sep 18, 2022

From #29 (comment):

node-fetch 3 introduces a lot of breaking changes, the most problematic one being that the package has been converted to an ES module which makes it impossible to import synchronously.

My preferred workaround for this would be to only import node-fetch in the worker process, where asynchronous imports do not matter. This however requires writing a replacement implementation for the Response, Request and Header interfaces in the main process.

@larsgw larsgw added the enhancement New feature or request label Sep 18, 2022
@larsgw larsgw pinned this issue Sep 18, 2022
@jimmywarting
Copy link

Any consideration to switch to using undici or builtin fetch instead?

the npm package require NodeJS v16
it got added globally in NodeJS v18

node-fetch isn't going to get so much newer features as they are more or less taking over...

@larsgw
Copy link
Owner Author

larsgw commented Apr 19, 2023

That's a good point. I'll check when 16 is EOL.

@larsgw
Copy link
Owner Author

larsgw commented Jun 11, 2023

(That would be 2023-09-11)

@d07RiV
Copy link

d07RiV commented Nov 13, 2024

Any update to this? Getting spammed with deprecation warnings now :(

@larsgw
Copy link
Owner Author

larsgw commented Nov 13, 2024

I'm swamped with other work this week, but I'm going to work on this next week.

@larsgw
Copy link
Owner Author

larsgw commented Nov 19, 2024

Update: I got started with this but there are a bunch of incompatibilities that I need to resolve. Right now SyncResponse is a subclass of the Response from node-fetch, but if I make it a subclass from Node's Response instead I basically need to rewrite the whole class.

@larsgw
Copy link
Owner Author

larsgw commented Nov 19, 2024

@d07RiV I've published a prerelease version (v0.6.0-0), could you try it out?

@d07RiV
Copy link

d07RiV commented Dec 17, 2024

That works, thanks!

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