2

I'm trying to mutate an object with the help of AppSync console. when i execute my query it executes without any error but it didn't actually update the object in the database and returns the same object.

Here is my query

  updatePayment(input: {id: "7101d985-43e4-4fe9-8b29-51f8accc39e1", status: ERROR, amount: 92123}) {
    id
    account_number
    amount
    date
    status
  }
}

it was supposed to update the object with the given id and set status equal to Error.

The Result i got back

  "data": {
    "updatePayment": {
      "id": "7101d985-43e4-4fe9-8b29-51f8accc39e1",
      "account_number": "voluptatesinteueni",
      "amount": 15.041086320142963,
      "date": "2022-08-22T07:50:42.227Z",
      "status": "SCHEDULED"
    }
  }
}

it neither update anything in the database nor threw any error.

What could be the problem or how i could update it?

1 Answers1

0

Make sure that you pass the current version of the object under the _version field:

updatePayment(input: {id: "7101d985-43e4-4fe9-8b29-51f8accc39e1", status: ERROR, _version: payment._version, amount: 92123}) {
    id
    account_number
    amount
    date
    status
  }