Joe Ellul-Turner
Joe Ellul-Turner

Reputation: 21

AWS Appsync mutation not updating

I'm really new to aws and graphql. I'm trying to update the "score" of my database. I'm able to set a value for "score" when I create a new mutation. However, when I try to update a current mutation the value of "score" doesn't change.

    mutation update {
  updateScore(input: {id: "3c8571ad-817a-4c7f-a2a4-95b1e664f105", score: 0}) {
    id
    score
  }
}

mutation create {
  createScore(input: {score: 1}) {
    id
    score
  }
}

When query mutation update I'm still getting a score of 1

Upvotes: 0

Views: 682

Answers (1)

Hamid
Hamid

Reputation: 3052

I found the answer, unfortunately it's not documented yet on their website. Basically you need to pass the _version along with the update request. You can get the _version when you query the data. I posted the complete answer in the following link: AWS Graphql API mutation does not update DataStore

It's also answered by contributors on Github: https://github.com/aws-amplify/amplify-js/issues/10664

Upvotes: 4

Related Questions