GraphQL Input Object parsed differently when Query Variable is used
See original GitHub issueHi there.
My team and I have been scratching our heads on this one for awhile and (mostly) blaming Firebase (hard not to sometimes). But today we observed something that shows a clear difference in how GraphQL Input Objects are parsed in an Apollo GraphQL resolver depending on whether Query Variables are used or not.
I put a full description and screenshots with an easy app to clone and run at the github URL below.
Thanks.
package: It’s hard to tell which package is responsible, but searching through the Apollo code packages for instances of Object.create(null)
shows most all of the hits in apollo-server
. It’s possible the underlying cause is in one of the core or utils packages though.
expected behavior: Setting an Input Object via Query Variables behaves the same as if are manually entering all those fields in the Input Object portion of the GraphQL query/mutation (without query variable interpolation).
actual behavior: Manually setting the fields in an Input Object (without using a query variable) causes the Input Object to be treated like a dictionary (ie Object.create(null)
) where all Object prototype methods used on it throw an error
reproduction: https://github.com/arizonatribe/apollo-graphql-input-object-bug
Works when you build the query’s Input Object by using a query variable:
Does not work when you build the query’s Input Object is without using any query variables:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:26 (5 by maintainers)
Top GitHub Comments
I mean, yes, it it literally is not our problem. I think folks who have run into this problem and are finding it a direct challenge to their work are best equipped to file an issue explaining why it is a problem, rather than us as a third party.
@glasser, again, the sarcasm is 100% unhelpful and counter-productive. If you can’t have a civilized disagreement with someone, then please stop replying.