refactor: remove dependence node-fetch
close https://github.com/OneSignal/onesignal-node-api/issues/83
Description
One Line Summary
Remove node-fetch as fetch is available in the modern environments (browser and Node >= 18)
Details
Motivation
This package depends on node-fetch v2.x, which is old and depends on an old version of whatwg-url and causes warning "The punycode module is deprecated. Please use a userland alternative instead." in Node >= 22. node-fetch is not needed in the modern environments, see https://github.com/lquixada/cross-fetch/issues/177#issuecomment-2358005899
Scope
The package will use the Node built-in fetch
Testing
Manual testing
-
yarn prepare - I am not sure how to do further testing but I am happy to do so if I could get some guidance.
Checklist
Overview
- [x] I have filled out all REQUIRED sections above
- [x] PR does one thing
- If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
- [x] Any Public API changes are explained in the PR details and conform to existing APIs
Testing
- [x] I have personally tested this on my device, or explained why that is not possible
Final pass
- [x] Code is as readable as possible.
- Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
- [x] I have reviewed this PR myself, ensuring it meets each checklist item
- WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.
Hi @CHC383 and thanks for opening this PR. Unfortunately, the code in this repo is auto-generated by an upstream project, so I'm not able to accept outside contributions without it being overwritten in future releases. I can investigate removing node-fetch from the generator project which should achieve this same effect.
@sherwinski Got it, thanks, please remove it from the upstream project. BTW, any timeline for the new release which will also fix https://github.com/OneSignal/onesignal-node-api/issues/61?
Sorry, I don't have an updated timeline at this point. I am still in the process of amending other issues in the SDK but will look into it afterwards.
Reopen the PR as a reminder until the fix is applied in the upstream project
Hi @sherwinski, any updates on this? Is the upstream project available somewhere so that we could take a look and potentially contribute there?
Hey @CHC383,
The upstream project is private however, it is finally in a good place to start patching in fixes: starting with the removal of node-fetch. I'll open a PR and get the ball rolling on that today. #61 is also on my list of things to address after that.
Thanks for your patience as we work through these.
@CHC383 Good news, this should now be fixed in v5.1.0-beta1! Please give it a try and let me know if you have any questions.