amplify-category-api
amplify-category-api copied to clipboard
DeltaSyncWriteError on trying to update a Dynamodb row through appsync
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.20.1
Amplify CLI Version
11.0.3
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
None
Describe the bug
When attempting to update a specific DynamoDB row using GraphQL, I encounter a DeltaSyncWriteError with the message Failed to write delta sync record. On investigating, I found that the value is successfully updated in the backend. However, the API call still fails, resulting in the mentioned error. This discrepancy suggests an issue in the synchronization process or with the API response handling.
As far as I can see issue only exists on 1 particular row. The rest are fine. I can't think of anything that might have caused the issue. I can't recreate this issue either in any other env.
Its major blocker for an important client of ours any help will be greatly appreciated.
Expected behavior
API call to succeed and get me the updated values from graphql
Reproduction steps
- Create a graphql table.
- Create a row through graphql for that table .
- Update that row using graphql.
Project Identifier
8b6503fea4d84d8ae7c9b34e7f619040
Log output
# Put your logs below this line
// Graphql Payload
{
"query": "mutation UpdateCompany($input: UpdateCompanyInput!, $condition: ModelCompanyConditionInput) {
// Table keys
createdAt\n updatedAt\n _version\n _deleted\n _lastChangedAt\n }\n}\n",
"variables": {
"input": {
"phone": "t",
"id": "primary key",
"_version": 1343
}
}
}
//Graphql response
{
"data": {
"updateCompany": null
},
"errors": [
{
"path": [
"updateCompany"
],
"data": {
// updated data is being shown here
},
"errorType": "DeltaSyncWriteError",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 3,
"sourceName": null
}
],
"message": "Failed to write delta sync record."
}
]
}
Additional information
No response
Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
If you're here from Google trying to solve this, you might have created the app with an old version of Amplify. Check the AmplifyDataStore table on DynamoDB, and make sure that the PartitionKey and SortKey are both "ds_pk" and "ds_sk" respectively.
For some reason, on my version it was set to "pk" and "sk" even though it was created by the CLI. Manually deleting and then recreating the table resolved the issue for me.
Hey @DevTGhosh, Can you confirm if the suggestion above resolved your problem?
@AnilMaktala nope issue is still there.
I had the same awkward weird issue until I turned off this:
I'm new to AWS and still learning...
@DevTGhosh Please let me know if this works for you and someone explain why?