Describe the bug
AWS AppSync does not report an error when request is incorrect.
To Reproduce
We are using the @aws-amplify/api npm package to make AppSync mutations. Accidentally, one of our mutation requests did not contain an ID.
Expected behavior
I expected the AppSync logging, within the appropriate CloudWatch LogGroup, to report some kind of error. However, after inspecting the logs, I noticed that AppSync reports nothing is wrong. It even returns a 200 response. We were notified of this bug in the frontend console because it looks like the @aws-amplify/api somehow determines there was an error. We rely on CloudWatch alarms to notify us of an issue. I do not know of a good way to trigger an alarm in this case.
Hi @ambriglia
Accidentally, one of our mutation requests did not contain an ID.
Depending on how your AppSync api was provisioned, you could have a request mapping template that is auto generating a uuid for you if one is not present in the input arguments.
But, if @aws-amplify/api is reporting an error but got a 200 response back, this means that it got back a GraphQL error (not a general http error) with potentially partial data (see e.g. https://spec.graphql.org/June2018/#example-90475 )
May I ask what kind of error was received in your frontend console?
I am not sure why you don't see the error in CloudWatch, for that my suggestion would be to contact the AppSync service team in the support forums
@manueliglesias Here is the error... failed to save animal: {"data":null,"errors":[{"path":null,"locations":[{"line":1,"column":24,"sourceName":null}],"message":"Variable 'input' has coerced Null value for NonNull type 'ID!'"}]}
That first link you provided above seems like it might be what we are experiencing.
The odd thing is that in the cloudwatch logs, appsync does not log out the actual response body data. I guess this is for privacy reasons? Regardless, because the response body is never logged, there is nothing else in the logs that helps me determine this was an error.
If there is not an amplify concern here, I can try and ask this question for the appsync service team, which you linked above. Thanks.
Yes––this would be a question for the AppSync service team.