-
Notifications
You must be signed in to change notification settings - Fork 824
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
Different error behavior for Amplify mock vs real API: "Cannot return null for non-nullable field" #6450
Comments
I have not found the source of the problem but it is connected to the way you configure If the schema would use
But I'm trying to make it work with |
It appears that https://github.com/aws-amplify/amplify-cli/releases/tag/v4.42.0 contains this, however I am still seeing this issue. |
i am having this same issue on 4.43.0, any advise? |
For anyone running into this issue (on v4.43.0), here's a workaround (pretty hackey but will suffice for now): replace all of your
|
I am having the opposite problem compared to the the OP's original issue - my local mocked API works fine, but subscriptions are failing on the deployed API due to the error "Cannot return null for non-nullable type: 'String' within parent 'Form' (/onCreateForm/name)". The 'Form' item is created successfully and can be subsequently queried - it is only the subscription throwing the error. Here is the full output from the subscription: {
"data": {
"onCreateForm": null
},
"errors": [
{
"message": "Cannot return null for non-nullable type: 'String' within parent 'Form' (/onCreateForm/name)",
"path": [
"onCreateForm",
"name"
]
}
]
} Please let me know if there is any other information that might be helpful in debugging this issue. It seems to be fairly new - I wasn't having this issue with my deployed API as early as about a week ago. |
This comment fixed me: #5542 (comment) Adding the field in the return value from the mutation allows the subscription access to the field. I'm still not sure why it works fine in the locally mocked API and not the deployed one. But I'll take it! |
I think this needs to be looked into. Amplify mock hasn't worked for us for weeks. |
Also having this same issue on incoming subscriptions:
The comment mentioned by @cwinters8 does not seem to resolve anything in my case as my subscriptions and mutations already have identical values. |
I'm running v4.44.1 and this issue is still alive and kicking. The easiest way to reproduce it is to simply query a record that doesn't exist with a non-nullable in the expected results. |
Yup same here. I upgrade the CLI every release and this is the first thing I check. Haven't been able to mock in weeks. Really frustrating. |
Fix for this issue was merged and released in the latest version of the CLI. |
Confirmed ty! |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Describe the bug
Mock API throws error on non-nullable field of nested object when connection does not exist, real API works fine.
Amplify CLI Version
4.41.2
To Reproduce
schema.graphql
:amplify push --y
to deploy the APIamplify mock
This results in an error:
This gives me the following result (no error):
Expected behavior
I expect the mock API to behave without errors as well.
Screenshots
On the left the response in the AppSync console, on the left the local Amplify mock API.
Desktop:
Log output
Include any relevant log output under
~/.amplify/logs/amplify-cli-<issue-date>.log
I don't see anything relevant here:
Related issue
This seems to be related but no solution was provided yet: #2248
The text was updated successfully, but these errors were encountered: