I am trying to perform an update on DynamoDB table.
The code is (Node.js):
let params = {
TableName: Organizations.Table,
Key: {
'ID': event.ID
},
UpdateExpression: 'SET #OrgName = :org, #Description = :desc',
ExpressionAttributeNames: {
'#OrgName': 'OrgName',
'#Description': 'Description'
},
ExpressionAtributeValues: {
':org': event.OrgName,
':desc': event.Description
},
ReturnValues: 'UPDATED_NEW'
};
this.docClient.update(params, (err, data) => {
if (err) {
return cb(err);
}
return cb(null, data);
});
The event object has all the properties needed.
After executing I get an error:
Invalid UpdateExpression: An expression attribute value used in expression is not defined; attribute value: :desc
I just followed the examples from DynamoDB docs.
When I change the order of set values, e.g. to SET #Description = :desc, #OrgName = :org the error I get will be about attribute value :org. I also tried to specify expression attribute values explicitly, didn't help.
I can't get what is wrong.
Can someone help me?