type Query is missing Error
idkjs opened this issue ยท 4 comments
The following query works in Graphiql
and curl
and can be see here:
curl 'https://j96vt.sse.codesandbox.io/' -H 'Accept-Encoding: gzip, deflate, br' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'Connection: keep-alive' -H 'DNT: 1' -H 'Origin: https://j96vt.sse.codesandbox.io' --data-binary '{"query":"# Write your query or mutation here\nquery CharacterList {\n getCharacters(sortDirection: ASC) {\n id\n name\n playedBy\n culture\n allegiances {\n name\n }\n isAlive\n }\n}"}' --compressed
Or open https://j96vt.sse.codesandbox.io/ and add this query
query CharacterList {
getCharacters(sortDirection: ASC) {
id
name
playedBy
culture
allegiances {
name
}
isAlive
}
}
When you run this project, you get the following error in the browser console.
Error: graphql_ppx: Field getCharacters on type Query is missing Index.js line 684 > eval:6:9
You can see the live errors by opening https://graphql-ppx-error.idkjs.now.sh/ the opening the dev tools console.
The field is obviously there. Maybe I am missing something?
Server can be found here and running at https://j96vt.sse.codesandbox.io/
App reproduction can be found here: https://github.com/idkjs/reason-hooks-graphqlppx-issue-repro.
Thanks for any assistance.
Thank you for such details issue and great reproduction step!
This error is not related to graphql_ppx
. It's an issue with reason-apollo-hooks
. When Apollo client returns empty object graphql_ppx
generated parse function fails because it's not what we expect. I assume it's because Apollo client fetch policy. I created PR in reason-apollo-hooks with a fix to your issue.
/ cc @fakenickels
I thought it might be here or hooks. Figured I would start here. All the reproduction was because I wanted to be sure i wasnt asking something stupid. Glad it helps. Will check out your pr.
fixed with reason-apollo-hooks commit reasonml-community/reason-apollo-hooks@58c1b5e
Thank you, gentleman.
Thanks for the help!