Amplify Datastore.save does not update backend

93 views Asked by At

Here is the code, and I am trying to update the ShortId records

await DataStore.save(
                ShortID.copyOf(ShortIDRecord, (updated) => {
                  Object.assign(updated, modelFields);
                })
              );

The problem in here is the _version var updates but not the short_id field.

The input data is abcdgedefga, but the return response is original asabcdged

{
    "data": {
        "updateShortID": {
            "id": "3a83342f-e4f9-4b6b-a91f-d1003277b561",
            "short_id": "abcdged",
            "createdAt": "2023-09-16T06:44:48.037Z",
            "updatedAt": "2023-09-16T06:44:48.037Z",
            "_version": 2,
            "_lastChangedAt": 1694846699836,
            "_deleted": null
        }
    }
}

ps, also tried the same process with API.graphql; the same result of update failure; but _lastChangedAt and _version are updated, other remain the same

0

There are 0 answers