I am using DynamoDB locally with NoSQL Workbench and an Express API.
I have a table generated as such:
const params = {
AttributeDefinitions: [
{
AttributeName: 'id',
AttributeType: 'S',
},
],
KeySchema: [
{
AttributeName: 'id',
KeyType: 'HASH',
}
]
TableName: table.name,
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1
},
}
dynamo.createTable(params).promise() // ... simplified version
I update an item using the DocumentClient as such:
const db = new AWS.DynamoDB.DocumentClient(configOptions);
const data = await db.put({
TableName,
Item,
}) // ... interact with result
Occasionally, it creates a new item in DynamoDB with the exact same id value even though I created it as a HASH and made it the partition key.
However, it doesn't happen every time. I can't seem to recreate it consistently.
Is there something I'm doing wrong with how I'm creating this table or updating this item that is leading to this?
See items 97/98 here, this image is of my NoSQL Workbench and you can see there are two items with the same id

After getting in touch with AWS Support, it turns out this is a known issue with using DynamoDB locally. They provided the following guidance for fixing it: