-
Notifications
You must be signed in to change notification settings - Fork 63
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
Mutations break after aws-amplify/cli update: "input contains a field that is not defined" #832
Comments
Hey @ok-martin 👋 thanks for raising this! I'm going to transfer this over to our API repo for tracking 🙂 |
Hi @ok-martin, the changeset from
I am confused by this part since the types defined here are independent of the mutation that is failing for you. Do you happen to have a diff of |
Hi @phani-srikar I am confused by that too. Here is the diff on the mutation file: It is essentially the same but with |
As a workaround, you can disable the addition of
Another thing to try, could you add a newline somewhere in GraphQL schema and then try to |
Hey @ok-martin, Are you still experiencing this issue? |
Hey 👋 , This issue is being closed due to inactivity. If you are still experiencing the same problem and need further assistance, please feel free to leave a comment. This will enable us to reopen the issue and provide you with the necessary support. |
This issue is now closed. Comments on closed issues are hard for our team to see. |
I am still experiencing the issue. It seems that it only fails to update on objects that are already in the database. If I insert a new row and then try to update it, then it all works ok. However, when I try to update a row that was already there (from version 12.0.0) then the update fails. |
I can confirm that the problem occurs when updating sub-fields that are missing Is there a way to auto populate those sub-fields with P.S thank you @dpilch. Your workaround works but I would rather solve it the proper way in case this becomes an issue with the future versions of Amplify :) |
I have the same problem. I get a list of existing objects from the database, something like:
I then do some updates to one of the
Then I get the error message (like the OP)
The reason is there's a child array field called "codes" of type CodeInput. In the model schema it looks like It would be nice if either the update ignored that, or the query didn't add it. It's weird to get an object back from a query that you can't send directly back to an update call. I'm using Gen 2, and don't have that yml file mentioned above, so if anyone else is in the same boat before this gets fixed I made a function:
Just call that on your object before sending it to the update call and it'll clean out any |
How did you install the Amplify CLI?
npm install -g @aws-amplify/[email protected]
If applicable, what version of Node.js are you using?
21.7.1
Amplify CLI Version
12.10.1
GraphQL transformer version: 2
What operating system are you using?
Windows
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
After upgrading from
@aws-amplify/[email protected]
to@aws-amplify/[email protected]
I am unable to do any mutations. All of them return the error:"The variables input contains a field that is not defined for input object type 'DirListInput' "
Expected behavior
Carry out the mutation successfully without throwing an error as it did in
@aws-amplify/[email protected]
Reproduction steps
I am running a react app with
"aws-amplify": "5.3.17"
amplify push --y
it changed:The difference in those files was that it added
__typename
to every type, input, mutation and querywhere inputData is:
But it throws the error
updateDbDirTable
is auto-generated insrc/graphql/mutations
. I am not using any custom resolvers or overridesProject Identifier
No response
Log output
Additional information
If I discard changes in the graphql the code in step 3 works ok
If I downgrade to 12.0.0 and re-generate the graphql files the code in step 3 works ok
Same issue on 12.4.0 because it adds the same changes as 12.10.1 to the auto-generated graphql and API
I noticed that if I keep all of the regenerated changes and only discard the
src/graphql/queries.ts
then the code works okThe only new change in
src/graphql/queries.ts
is that it added__typename
everywhere.This is strange since all my queries, when called directly, work fine with the newly generated file and they fetch the data ok.
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: