-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Ensure transporters are using isomorphic-fetch instead of browser only whatwg-fetch #1018
Ensure transporters are using isomorphic-fetch instead of browser only whatwg-fetch #1018
Conversation
@guilhermeblanco: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/ |
dd7d884
to
7dd8535
Compare
CLA signed. |
You can also just install |
@stubailo That's what I did, but it doesn't solve the problem. |
That's surprising, since it works well here in GitHunt's server side rendering code: https://github.com/apollostack/GitHunt-React/blob/b91466f625ba5b43bed3b7957a406eccb837de0f/ui/server.js#L9 Are you sure something else isn't going on? Also, I would rather accept a PR that checks for |
@stubailo GitHunt's makes a global import, then defining I assume this library should operate on both ends (server and client), so it makes sense it use a tool that enables that. isomorphic-fetch is not a complex tool, and will address this problem of this library forever. However, if you still think |
|
Thanks @guilhermeblanco. As far as I can tell there's no downside to using isomorphic-fetch as opposed to whatwg-fetch, so I'll go ahead and merge this. |
My apology if this is not a correct place to report the issue, but I just want to check if this is actually an issue and not just me. I have upgrade
It's thrown from If this is an actual issue on |
@sntran Hm, that's unfortunate indeed. We definitely can't use isomorphic-fetch if it breaks react-native. @guilhermeblanco maybe you can convince the author of isomorphic-fetch to take care of the issue on their side or find another isomorphic fetch package? |
Introduction
I have 3 distinct projects:
A - Client UI. Executes GraphQL queries against GraphQL server B
B - GraphQL server, responsible to fetch information from third-party vendor API and upon response trigger subsequent queries to GraphQL server C
C - GraphQL server, wrapping another third-party vendor API
Problem resides on B. Whenever A issues a query that contains the field that requires B to contact C, it crashes.
This is understandable, since
apollo-client
transports usewhatwg-fetch
, which is meant to be used by browsers, and not by a node server. Switchingwhatwg-fetch
to a universally compatible packageisomorphic-fetch
(which uses thewhatwg-fetch
when on browser andnode-fetch
when on server), problem disappears.Situation
On a query that requires performing a query to server C, I have the following excerpt:
Error
Workaround
I'm not being blocked by this issue, as I defined
isomorphic-fetch
import toglobal
in my main JS file, like this: