Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DynamoDB Dashboard can't Save/Update Item: ConditionalCheckFailedException

I need to update an item in a table, using the AWS Console DDB Dashboard. But when I go into "Edit item" and click "Save", I keep getting a ConditionalCheckFailedException error.

I assume this means the existing item has a ConditionExpression which my new data is somehow violating. But I can't figure out how to view that expression from the Dashboard so I can determine what the issue is.

How can I view the ConditionExpression for an Item in a Table, from the AWS Console DDB Dashboard?

like image 645
BobDoolittle Avatar asked Oct 25 '25 12:10

BobDoolittle


1 Answers

I had the same problem and with the help of AWS support have solved it.

The issue arises because the DynamoDB console for the "Items" tab is a static display which takes a snapshot of all your items when it is first displayed. If you select an item and then return to the screen you still see the same snapshot - it is not updated.

When you try to update an item, the console sends the values of all the existing fields from the snapshot for this item and if any of these fields differ from their current values in DynamoDB then the update is rejected. So the "conditional expression" is referring to the requirements which the console is making for the update to be allowed.

So the workaround is to perform a browser window refresh on the item list before selecting the item you wish to edit and then hope you are fast enough with the edit to finish it before any external updates to the table change the data. Of course if you have a rapidly changing table then you will not be able to be quick enough and so the console is not the right tool for the job.

like image 88
GrahamC Avatar answered Oct 27 '25 00:10

GrahamC