-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Bug? DX issue?] DataStore opaquely coerces my NonNull field to Null and silently fails without error #7127
Comments
I can reproduce. I believe this is the exact same issue as mentioned in #5161 However, that issue does not seem to have a clear solution posted. With your code, I can reproduce the same amplify-js/packages/datastore/src/util.ts Lines 235 to 268 in 5173a99
Relevant files: Since we only set (I don't understand what L236-258 is doing though) I think you are expecting datastore to populate Anyways, after reviewing graphql docs and datastore docs. I'm not sure if your expected behavior above is supported, it seems like the relational modeling has limited support in datastore compared to GraphQL. #5054 (comment) also shows certain operations are just not yet possible with datastore at this time. I've made some modifications strictly following the datastore docs example and it's now functional. The repo is at wei/amplify-js-7127 and the commit can be seen at wei/amplify-js-7127@f03feac Summary of my changes in the commit:
Lastly, going back to the original question, this is the piece of code that runs on our error: amplify-js/packages/datastore/src/datastore/datastore.ts Lines 422 to 424 in 5173a99
I agree it's not immediately apparent that there has been an error, perhaps as an easy first step, we can change it to include the word amplify-js/packages/datastore/src/datastore/datastore.ts Lines 625 to 628 in 5173a99
or a different phrase to indicate an error. Any feedback❓ /cc @iartemiev |
i'm super grateful that you spent the time to repro!!!
|
Sure thing! RE (1): Could you start fresh with a new clone, checkout RE (2): I did notice some data sync errors show up as warnings, will need to defer to datastore maintainer for the reasoning behind that. |
RE (1): Check out #6973 ; )
I guess it's just not possible right now. For the time being you can work on top of my repo which is using what's currently possible with datastore to create trello-amplified. |
appreciate the superfast feedback!! so i guess the remaining question is:
|
Now, why did the model pass local validations `validateModelFields` before sending a appsync graphql request?
Snippet from
Snippet from `schema.js` missing boardID field definition:
So the code snippet in my first comment is setting |
@mauerbac we still were at "Definitely still worth more discussions." in the previous comment |
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
My
schema.graphql
:Here is what i am trying to do:
Yet when I run this code it does not error, does not save this to AppSync/DynamoDB, and logs this warning in the browser:
the full response is
{"data":null,"errors":[{"path":null,"locations":[{"line":1,"column":20,"sourceName":null}],"message":"Variable 'input' has coerced Null value for NonNull type 'ID!'"}]}
I assume this is just graphql helpfully suppressing the error for us. I would expect DataStore to surface this error.
However even this error message is not helpful, and I have no idea why DataStore is coercing what i have clearly checked is a string, to null. I am out of ideas on how to fix this.
To Reproduce
you can clone https://github.com/sw-yx/trello-amplified and add auth and add api (my attempt here)
or
you can watch my 2 minute video bug report here: https://youtu.be/25PWIBfhfZE
Expected behavior
context
The text was updated successfully, but these errors were encountered: