I have this strange issue with DynamoDB where I cannot seem to update an item.
Here is my command:
TableName: 'UserTable',
Key: { UID: { S: 'h4XJj3YRxZiF7TDcGkxAhc' } },
UpdateExpression: 'SET numRatings = :numRatings',
ExpressionAttributeValues: { ':numRatings': { N: 336 } },
ReturnValues: 'UPDATED_NEW'
I have verified that the table is correct, and that the key of the table UID does indeed have the hash h4XJj3YRxZiF7TDcGkxAhc
as a value. numRatings
currently is equal to 1.
Here's my code:
const params = {
TableName: process.env.USER_TABLE_NAME!,
Key: {
UID: {
S: UID
}
},
UpdateExpression: 'SET numRatings = :numRatings',
ExpressionAttributeValues: {
':numRatings': { N: numRatings } as unknown as AttributeValue
},
ReturnValues: 'UPDATED_NEW'
} as UpdateItemCommandInput;
try {
const result = await dbClient.send(new UpdateItemCommand(params));
...
Yet I get this error: NUMBER_VALUE cannot be converted to String
maybe I am blind but I cannot see where this conversion could be taking place.
I am using TypeScript and AWS-SDK 3.54.0
If anyone is able to point out what I am doing wrong I would greatly appreciate it.