Based on the comments.
The issue seems to be related to read consistency of GetItem
. By default, GetItem
uses Eventually Consistent reads:
When you read data from a DynamoDB table, the response might not reflect the results of a recently completed write operation.
To overcome the limitation of the eventually consistent mode, strongly consistent reads can be used:
DynamoDB returns a response with the most up-to-date data
Please note, that strongly consistent reads cost twice as much as eventually consistent reads. There are also other limitations to strongly consistent reads, described in the linked docs.
The alternative could be the use of exponential backoff when using eventually consistent reads, until the GetItem
succeeds.
CLICK HERE to find out more related problems solutions.