aws-appsync-community
aws-appsync-community copied to clipboard
Using query variables does not generate the same errors as statically filled queries
Hello,
We've run into an issue with how error are not handled correctly when using Query Variables to fill a Query/Mutation.
Here is an example how it goes wrong: Mutation:
mutation createUpdateTest($input: [CreateUpdateTestInput!]!) {
createUpdateTest(input: $input) {
items {
id
}
}
}
Query Variables:
{
"input": {
"testa": "test",
}
}
Output:
{
"data": null,
"errors": [
{
"path": null,
"locations": null,
"message": "The variables input contains a field that is not defined for input object type 'CreateUpdateTestInput' "
}
]
}
Note the lack of the missing field in the error
And here is an example how it goes correctly: Mutation:
mutation createUpdateTest {
createUpdateTest(input: {testa: "test"}) {
items {
id
}
}
}
Output:
{
"data": null,
"errors": [
{
"path": null,
"locations": [
{
"line": 2,
"column": 21,
"sourceName": null
}
],
"message": "Validation error of type WrongType: argument 'input' with value 'ObjectValue{objectFields=[ObjectField{name='testa', value=StringValue{value='test'}}]}' is missing required fields '[test]' @ 'createUpdateTest'"
}
]
}
Note the actual showing of the missing required fields.
Have we made a mistake with our appsync configuration? Is this working as intended or is this a bug?