-
Notifications
You must be signed in to change notification settings - Fork 39
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
Replace axios
with undici
#283
Comments
@benmccann thanks for the suggestion. |
Thanks for the reply @marandaneto! Unfortunately If you look at npmgraph.js.org/?q=posthog-node, you can see Given that node v15 end of life was reached 3,5 years ago, and the current LTS is v22, it might be worth raising the minimum supported node version above v18, and just remove |
@Lehoczky is there any stats about the % of people/apps using node < 18 and node >= 18, although I agree with the approach and I think its a good idea, its important to keep compatibility in mind, not every person/app migrates that fast. |
you can probably use yarn resolutions to |
Node 18 active support ended on 18 Oct 2023 and Node 18 security support ends on 30 Apr 2025. Maybe we should just wait until May to do this? |
I agree with this issue We should migrate from axios. Ideally to cross-runtime built-in fetch But for now i guess we can import it from undici (anyway nodejs fetch is undici fetch) axios is big in size and bugly sometimes |
fetch added in |
https://nodedownloads.nodeland.dev/ looks like nodejs <18 not so widely used for now also fetch can be used on and NodeJS <18 is out from maintance status i guess we should drop axios soon. it really important to achieve really tiny package its my dream... |
Is your feature request related to a problem?
axios
is a somewhat weighty dependency and doesn't adhere to thefetch
standardhttps://npmgraph.js.org/?q=axios
Describe the solution you'd like
Switch to
undici
.undici
is the officialfetch
implementation bundled with Node.js. This should be an easy change asfetch
is already used where available: https://github.com/PostHog/posthog-js-lite/blob/4fe4eb2aa5da5ec57f39481e57a712c6992991b4/posthog-node/src/fetch.ts#L17C10-L17C15It also would make an eventual migration to Node's built-in fetch easy as you could simply drop the import and use the one from Node
Describe alternatives you've considered
It would be nice to use
fetch
directly from Node. However, doing so requires Node 18 and this library still supports Node 15. Could we drop support for EOL versions of Node?Related sub-libraries
Additional context
Thank you for your feature request – we love each and every one!
The text was updated successfully, but these errors were encountered: