New Behavior (?) from Appsync -- Nested null @hasOne objects in createObject and updateObject (but NOT getObject or listObjects) resolvers throw errors on required attributes: "Cannot return null for non-nullable type: 'ID' within parent '<my nested model>'" #2679
Labels
How did you install the Amplify CLI?
N/A
If applicable, what version of Node.js are you using?
N/A
Amplify CLI Version
N/A
What operating system are you using?
N/A
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
If i do a createCompany with a null centralInfrastructureId, the 'nested' @hasone centralInfrastructure will be null.
The createCompany and updateCompany resolvers will then choke on the required fields from the nested Infrastructure.
gives me
If I remove the 'required' fields from the mutation return values, the errors go away.
To be clear, the mutation is successful but I think these errors are new, I believe, because I've been handling them so that any errors returned from graphql throw exceptions all over my app and I've only seen these exceptions in my app in the last few days.
But that's like a GetCompany, right? what happens if i do a GetCompany?
Success! No errors.
I can work around these new errors (though I'd rather not).
Is this suposed to be what happens? Create and Update resolvers return the same data as Get and List resolvers, but only the Create and Update resolvers return exceptions as well?
I also have similar schemas in different accounts (not exactly the same) and I haven't seen this behavior there.
Update resolvers don't throw exceptions on null nested @hasone objects in these different apps.
Expected behavior
Expect above CreateCompany mutation to not throw errors when nested @hasone object is null.
Reproduction steps
Project Identifier
d3r48sibna3q31
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: