Reputation: 11
I am running into an issue with the JavaScript v3 client for DynamoDB. According to the AWS documentation, I should be able to create an UpdateExpression which uses an ADD keyword to add an element to a list. When attempting this, it throws an error not recognizing the update expression.
If I run the same command using SET instead of ADD it works just fine, however, SET as noted in the documentation replaces the current value, and does not add to the list.
The Error:
"errorMessage": "Invalid UpdateExpression: Syntax error; token: \"=\", near: \"activeUsers = :au\"",
The Code:
const joinParams = {
TableName: tableName,
Key: {
id: myTable.Items[0].id
},
UpdateExpression: "SET activeUsers = :ac",
ExpressionAttributeValues: {
":ac": [user]
}
};
await docClient.update(joinParams).promise();
Upvotes: 0
Views: 1105