I am trying to update a specific list entry using a counter.
const taskParams = {
TableName: CONST.NAMES.SUJET_TABLE_NAME,
Key: {
id: defectId
},
UpdateExpression: "SET #list.#epicType.#tasks[#taskIndex].#tracking =:attrValue ",
ExpressionAttributeNames: {
'#list': 'epicsList',
'#tasks': 'tasks',
'#epicType': epicType,
'#taskIndex': taskCounter,
'#tracking': 'tracking',
},
ExpressionAttributeValues: {
':attrValue': epicData["tasks"][0]["tracking"],
},
};
try {
await documentClient.update(taskParams).promise();
console.log("Task successfully created.")
} catch (err) {
console.log("Unable to create Task ", err);
}
When executing I get the following error :
ValidationException: Invalid UpdateExpression: Syntax error; token: "#taskIndex", near: "[#taskIndex]"
Is the syntax wrong or is there something else I am not aware of?
