Custom validation rules break query argument validation
See original GitHub issueI try to query a model with the single id parameter The request looks like this: {“operationName”:“GetClient”,“variables”:{“id”:3},“query”:“query GetClient($id: Int!) {\n client(id: $id) {\n node {\n email\n id\n profile {\n phone\n name\n __typename\n }\n __typename\n }\n __typename\n }\n}\n”} Intended outcome: The operation succeeds and returns proper values Actual outcome: The response comes back with a status 400 and the following error: {“errors”:[{“message”:“Argument "id" of required type "Int!" was provided the variable "$id" which was not provided a runtime value.”,“name”:“ValidationError”,“locations”:[{“line”:2,“column”:14}]}]} How to reproduce the issue: Send a single id parameter in query variables to your grapqh-server-express This does happen ocasionally so you may do it several times At some point you will see that the $id is being sent properly, but it does not pass grapqh-server-express validation for some reason
Attaching screenshots from a browser network tab:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top GitHub Comments
I’m also running into this error during my upgrade to Apollo Server v2. (ref withspectrum/spectrum#3855 ) I don’t think it has anything to do with it being the single argument though, it happens for us with multiple arguments:
I think it has something to do with adding custom
validationRules
. This specific commit broke the build with this error (“Argument “id” of required type “ID!” was provided the variable “$id” which was not provided a runtime value.”): https://github.com/withspectrum/spectrum/pull/3855/commits/0cb181d462dc6c6fb1bd0f000845f3029e3e9eba Before that it was working perfectly fine.Closing this because it doesn’t seem like an issue with Apollo Server itself.