Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Decide which SSR Data Fetching Library to use #258

Closed
phoenisx opened this issue Nov 24, 2019 · 15 comments
Closed

Decide which SSR Data Fetching Library to use #258

phoenisx opened this issue Nov 24, 2019 · 15 comments
Labels
Discussion Ideas, feature requests, views on features. Anything which is a discussion.

Comments

@phoenisx
Copy link
Contributor

phoenisx commented Nov 24, 2019

List of Libraries that has been discussed till date:

  • isomorphic-fetch
  • isomorphic-unfetch
  • axios
  • cross-fetch
  • node-fetch
  • whatwg-fetch

Last two libraries, if used, should be used together, as they are not isomorphic in nature.

@Zeko369 suggested, respective to PR #140, we are already using isomorphic-fetch

@Sonicrida suggested axios is not maintained for a while and has some security vulnerabilities.
@Shub1427 concluded that isomorphic-fetch, isomorphic-unfetch and axios hasn't been maintained for a long period, though recently from September axios has a new core developer helping to resolve issues as fast as he could.

Regarding security vulnerability for axios, it was a false alarm as per this.

@nik-john suggested to use cross-fetch which seems a viable option, as it's being actively maintained, and is a wrapper around node-fetch and whatwg-fetch (which I was trying to do by myself in PR #166).

This discussion needs to be concluded, as the PR #166 is been on hold for a long time now due to this and acts as a blocker to the same.

@phoenisx phoenisx added the Discussion Ideas, feature requests, views on features. Anything which is a discussion. label Nov 24, 2019
@allella
Copy link
Contributor

allella commented Nov 24, 2019

Pinging @vaibhavsingh97 @joelrozen @ThomasRoest @xarielx @Haxified for help resolving this decision.

@nik-john
Copy link
Contributor

Screenshot_20191124-100832_Chrome

I personally use node-fetch on my projects but my arguments for cross-fetch are that it seems to be well maintained, but it looks like it's not as widely adopted yet.

@joelrozen
Copy link
Contributor

Another one to consider is SWR (https://github.com/zeit/swr) which, given we are using zeit's next.js anyway, may be the better way to go.

@Zeko369
Copy link
Member

Zeko369 commented Nov 24, 2019

@joelrozen SWR is a wrapper around any fetch function so that isn't what we're looking for, since we still need to provide a fetcher function
Screenshot_20191124-232832_Chrome

@joelrozen
Copy link
Contributor

@Zeko369 ahhhh ooops.
Okay, well I'll go with whatever every one else decides, since I've only had experience with axios anyway and that seems to be out, so no opinion either way on the other choices.

@phoenisx
Copy link
Contributor Author

Personally, I would like to work with node-fetch and whatwg-fetch. They are well maintained and widely used as well.

cross-fetch is a wrapper around above two libs, which we can do ourselves or use cross-fetch instead.

NextJS supports conditional imports:

@Zeko369
Copy link
Member

Zeko369 commented Nov 25, 2019

+1 cross-fetch

@allella
Copy link
Contributor

allella commented Nov 25, 2019

There seems to be support for from @Zeko369, @Shub1427 @nik-john about cross-fetch (a wrapper around node-fetch and whatwg-fetch)

@Sonicrida @joelrozen any opposition?

@robertt
Copy link
Contributor

robertt commented Nov 25, 2019

cross-fetch 100%

@Zeko369
Copy link
Member

Zeko369 commented Nov 25, 2019

@timmyichen

@timmyichen
Copy link
Contributor

I'm pretty indifferent about which library is chosen as long as it fulfills all our needs

@Vitao18
Copy link

Vitao18 commented Nov 25, 2019

I'd prefer to use cross-fetch

@nik-john
Copy link
Contributor

Ok closing this as cross-fetch seems to be the consensus

@Shub1427 Hopefully this unblocks you

@bernhard-hofmann
Copy link
Contributor

bernhard-hofmann commented Nov 26, 2019

Do we have the criteria for selection?

There seem to be a lot of opinions and they're based on a variety of criteria. If we start with a prioritised list of requirements and desires I think we'll find it easier to reach an objective consensus.

Sorry, I didn't spot that this was closed. Could we retrospectively define the criteria we used for the selection?

@nik-john
Copy link
Contributor

@bernhard-hofmann It's pretty straight forward - because we're going to use this library extensively on Chapter (in no particular order):

  • It needs to be a robust library with no glaring open issues
  • It needs to perform all functions of an HTTP library
  • It has to be actively maintained
  • It needs to work seamlessly on the server as well as the client
  • It should have a hassle-free integration with NextJS

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Discussion Ideas, feature requests, views on features. Anything which is a discussion.
Projects
None yet
Development

No branches or pull requests

9 participants