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

Replace axios #18

Open
rhamzeh opened this issue May 22, 2023 · 5 comments
Open

Replace axios #18

rhamzeh opened this issue May 22, 2023 · 5 comments

Comments

@rhamzeh
Copy link
Member

rhamzeh commented May 22, 2023

Summary

axios v1 has brought a few breaking changes, so now's the time to reconsider whether it still is the best solution we have.

Motivation(s)

  • http2/http3 support
  • streaming support
  • reduce dependencies

Downsides

  • Breaking change - axios is very tied to our responses, anyone who currently depends on them will have some work to do before they can upgrade

Alternatives to consider

  • axios: it's working, stick to it, but update to a v1.x.x+ version (no http2 support yet)
  • fetch: built into recent browsers and node 18+
  • gaxios: close to the axios interface, supports http2, no browser support
  • got: Seems to satisfy a lot constraints. No browser support and has a lot of dependencies
  • ky: tiny, no dependencies, supports deno
  • undici: from the core node devs
  • ...

Criteria for success

  • Compatible license (required)
  • Node.js 18+ support (required)
  • Brings in a minimal set of dependencies (required)
  • Promise based (required)
  • Preferably not another dependency
  • Streaming support: allows us to expose the streaming ListObjects
  • http2/http3 support: reduces request overhead
  • Browser support: needed for the Playground
  • Deno support (Support for Deno #17)
  • Error handling and automated retries (bonus - lets us drop our own implementation)
  • Credential flow support (bonus - lets us drop our own implementation)
  • Built-in caching support (bonus)
@RichiCoder1
Copy link

I can definitely recommend ky. It's fetch with an excellent interface.

@ntotten
Copy link

ntotten commented May 29, 2024

The replacement should also support Cloudflare Workers like environments (#72)

@nicoduj
Copy link

nicoduj commented May 30, 2024

Hi,
Considering support for http corporate proxy with self signed certificate maybe ? ( see https://github.com/orgs/openfga/discussions/310 )

@rhamzeh
Copy link
Member Author

rhamzeh commented May 30, 2024

Just as an FYI - we are planning on starting work on this within the next two months.

We are leaning heavily towards undici, mostly for performance & current maintenance reasons. Ensuring compatibility w/ fetch in environments where undici is not available (Cloudflare Workers, Vercel, Browser, etc..) is part of this work

@gitaugakwa
Copy link

I think got would be a great alternative, though I think anything but axios would be fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

5 participants