-
Notifications
You must be signed in to change notification settings - Fork 199
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
Unexpected change in Amplify.API.mutate behavior "Cannot return null for non-nullable type within parent" #3913
Comments
I've just updated Amplify version to latest 2.44.0, the issue still exists |
I figured the problem, the GraphQLRequest query builder tries to dump all fields into graphql query body (document), including the associated fields, however those fields with association are not returned in response. Here is my workaround, tries to remove any association from the generated graphql mutation query document. Looking forward to a permanent solution.
|
Hi @uxian. Glad you have a workaround available. I've marked this as a bug pending further investigation. |
Describe the bug
Error:
Failed to create graphql GraphQLResponseError<Like>: GraphQL service returned a partially-successful response containing errors: [Amplify.GraphQLError(message: "Cannot return null for non-nullable type: \'ID\' within parent \'User\' (/createLike/user/id)", locations: nil, path: Optional([Amplify.JSONValue.string("createLike"), Amplify.JSONValue.string("user"), Amplify.JSONValue.string("id")]), extensions: nil)]
Following code used to work, but after upgrading to newer version of Amplify, it starts to fall apart. I don't need associated entities when doing Amplify.API.mutate, and I suppose the backend shouldn't query associated entities by default, but somehow the response deserializer start to demand the associated entity which supposed to be optional.
Following are model schema
Steps To Reproduce
Expected behavior
should not throw exception
Amplify Framework Version
2.29.2
Amplify Categories
API
Dependency manager
Swift PM
Swift version
5.x
CLI version
12.13.0
Xcode version
15.3
Relevant log output
Is this a regression?
Yes
Regression additional context
No response
Platforms
iOS
OS Version
17.0
Device
iPhone14
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: