Skip to content

replace Axios with Fetch API #1627

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

Open
turadg opened this issue Feb 12, 2025 · 3 comments · May be fixed by #1645
Open

replace Axios with Fetch API #1627

turadg opened this issue Feb 12, 2025 · 3 comments · May be fixed by #1645

Comments

@turadg
Copy link

turadg commented Feb 12, 2025

Problem

Axios adds weight and is not compatible with frozen prototypes,

Suggestion

Replace uses of Axios with Fetch API.

Browsers and now NodeJs support WHATWG Fetch. It's available in all LTS versions of Node.js and is no longer experimental.

@webmaster128
Copy link
Member

Sounds good. But according to https://blog.logrocket.com/fetch-api-node-js/, both node 18 and 20 do not have a stable fetch implementation yet

@turadg
Copy link
Author

turadg commented Feb 12, 2025

Aw, bummer. It looks like the blockers for stable were something with cookie and some perf,

If those aren't blockers for Tendermint RPC (they aren't in my case) then this could proceed.

@dynst
Copy link

dynst commented May 3, 2025

Relevant historical commit: #1240 / 182b1e7

Sounds good. But according to https://blog.logrocket.com/fetch-api-node-js/, both node 18 and 20 do not have a stable fetch implementation yet

It wasn't officially marked 'stable' in 18, but it didn't require an experimental feature flag anymore either.

The blog also recommends just using a polyfill:

Additionally, for legacy projects where upgrading Node.js isn’t an option, you can use a library like node-fetch to add Fetch support to your project.

So migrating from axios to minipass-fetch, node-fetch or cross-fetch (all less than 5% of the unpacked size of axios) for now would make sense if 18's fetch is unuseable. (18 is EOL as of April 30, though.)

@dynst dynst linked a pull request May 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants