-
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
Some GraphQL servers return an empty error array, even though it's not spec compliant #156
Comments
I'll take a look soon, thanks for reporting! |
Thanks @stubailo I really do like the approach you guys are taking with this apollo-client, I'm looking forward to integrated it. 😄 |
Could we get a code sample of the react component too? |
@WilliamHolmes what version of react-apollo are you using, this sounds like it may be an issue with the connect component |
"apollo-client": "0.1.6", hmm. I have a feeling your about to tell me to update my react components. 😄 |
@WilliamHolmes maybe! It depends on how you are accessing the data from apollo-react (if that is what is causing the error) the props from your query:
v0.2.*
|
@WilliamHolmes any updates? really curious to hear what is going on. |
@stubailo I was out for a few day, will try to update and test again. |
@stubailo I've tried to reduce the code down to the basic modules (still having the same issue) NOTE: package.json : I've updated all the versions, but still the same error. "apollo-client": "0.2.0", |
Where's your schema and resolvers? |
@abhiaiyer91 I can't include our schema, but you can change the query in App.js to suit whatever schema your GraphQL server is using. I've already verified locally that the Posted query and server response is what is expected. Updated: I also tried other queries to eliminate the "viewer key" with similar issues. Server Response (Headers include: Content-Type:application/json) Error in Props |
It's the If it's not present (in the root) then everything works as expected, otherwise when its present we see this issue. I believe the errors attribute (even if it's an empty array) is a valid GraphQL response. |
Ooooooooooh! Thank you for identifying this. Seems related to #51 @WilliamHolmes what GraphQL server are you using? It's a bummer but GraphQL doesn't really have enough guidelines for errors to treat them in a sane way.... |
@stubailo It's graphql-java |
@WilliamHolmes on a scale of 1 to 10, how sure are you that the empty error array is the underlying problem? As in, should I rename this issue, or open a new one? |
I'll commit at 10. |
@WilliamHolmes thanks for the confidence! Should be a trivial fix. |
@WilliamHolmes I think you should file an issue on graphql-java. The GraphQL spec says:
|
#lawyered |
Maybe this client could provide a more comprehensible error message? |
Yeah this is definitely still a "bug" in my mind! But now we have a specific cause isolated. |
Fix #156 by accepting non-spec-compliant empty error array
Fixing some of the internal error messages would be nice though so that these are easier to identify... |
add a note regarding reducer for custom redux actions
Our GraphQL schema QueryRoot contains a type Viewer which we use to query most of the data.
Apollo doesn't seem to like this causing the error
Can't find field viewer on object [object Object]
I have validated (and verified the response) with this simple query using GraphiQL
Query
{ viewer { me { displayName } } }
Response
{ "data": { "viewer": { "me": { "displayName": "William Holmes" } } }, "errors": [] }
REF: apollostack/apollo-client/src/networkInterface.ts#L91
I'm using React Integration with mapQueriesToProps and connect
export default connect({ mapQueriesToProps })(MyComponent);
The text was updated successfully, but these errors were encountered: