-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Variable "$id_0" of type "ID" used in position expecting type "ID!" error when refetching. #839
Comments
Thanks for reporting this. Is this a query that you wrote directly (i.e. in a route), or is this a query that Relay generated (i.e. from a setVariables call)? If the latter, how was the node originally fetched, and what was the type of its |
That query is generated by relay. This is the original query (generated using routes and fragments by relay): {
"query":"query App{resources{id,...F0}} fragment F0 on Resources{memory{total,used,when,id},cpu{total,used,when,id},disk{total,used,when,id},id}",
"variables":{
}
} I then use {
"query":"query Overview($id_0:ID){node(id:$id_0){id,__typename,...F0}} fragment F0 on Resources{memory{total,used,when,id},cpu{total,used,when,id},disk{total,used,when,id},id}",
"variables":{
"id_0":"cmVzb3VyY2VzOnJlc291cmNlcw=="
}
} The type (I am using the golang version of graphql + relay) is a string. |
Had the exact same problem today at my company for Innovation Day. Relay was generating the query when I called Hack I did to get it to work for demo day tomoz was to remove the non null wrapping on the ID argument of node:
And here is the query that errored:
Adding a Side note: Loving GraphQL and Relay the more I use it, keep up the good work! |
@F21 @albertstill thanks for the extra information, I see what's going on. This is an inadvertent side-effect of d55b04e, which explicitly set all query metadata including the |
This is fixed and master and will go out in the next release. Thanks everyone for the examples and repro steps! |
Relay generates queries like this when fetching:
The type for ID should be
ID!
rather thanID
, otherwise we get this error:The text was updated successfully, but these errors were encountered: