Skip to content

task: Replace Axios with native Fetch - #18698

Closed
toufali wants to merge 9 commits into
mainfrom
task/replace-axios
Closed

task: Replace Axios with native Fetch#18698
toufali wants to merge 9 commits into
mainfrom
task/replace-axios

Conversation

@toufali

@toufali toufali commented Apr 9, 2025

Copy link
Copy Markdown
Member

Because

Axios continues to be flagged with high vulnerabilities and maintaining the extra dependency is time-consuming

This pull request

replaces Axios with native fetch.

Issue that this pull request solves

Closes: FXA-11465
Closes: FXA-11503

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

Other information (Optional)

  • native fetch is already the dominant HTTP request API used throughout the codebase.
  • TODO: fix broken tests

In a couple instances, custom agents are created and passed to Axios via the "agent" option, to allow advanced connection management. Native fetch does not include this option. Connection reuse is handled internally via undici, which is suggested to be highly optimized for performance and connection pooling out-of-the-box.

Rather than remove the Axios-enabled advanced connection management, I resorted to using node-fetch in these instances, instead of native fetch. node-fetch is already a dependency of ours, and exposes the "agent" option for connection management. Should we decide that undici's connection reuse provides enough performance, we can remove the agents and use native fetch instead of node-fetch.

@toufali
toufali force-pushed the task/replace-axios branch 2 times, most recently from 3b41107 to 865bed4 Compare April 20, 2025 22:54
@toufali
toufali force-pushed the task/replace-axios branch from 865bed4 to f20f552 Compare April 22, 2025 06:59
@toufali
toufali force-pushed the task/replace-axios branch from c3ab7e8 to 312d48f Compare April 22, 2025 15:29
@vpomerleau

Copy link
Copy Markdown
Contributor

@toufali should we close this PR for now?

@toufali toufali closed this May 20, 2025
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 this pull request may close these issues.

2 participants