I'm facing issue when appending a list to a column in DynamoDB

Hello Everyone. Would like your help.

I have a table in DynamoDB, with a field which holds an array of hash data. When I’m trying to add items to the field, I’m not getting any error, however, the data is not getting appended into the field. Please find below the code, all the values are present in the params.


One more thing is that the code which is commented when I uncomment and run it the following error is generated.

message: 'The provided key element does not match the schema',
code: 'ValidationException',
time: 2018-12-21T09:49:40.057Z,
statusCode: 400,
retryable: false,
retryDelay: 18.331571480443966 }
Serverless: According to the API Gateway specs, the body content must be stringified. Check your Lambda response and make sure you are invoking JSON.stringify(YOUR_CONTENT) on your body object

I don’t have time to elaborate an answer due to Xmas celebrations, but iirc, this update statement works for me:

  const params = {
    TableName: `${APP}-${STAGE}-tags`,
    Key: {uuid},
    UpdateExpression: 'ADD tags :tags',
    ExpressionAttributeValues: {
      ':tags': docClient.createSet(['foo', 'bar', 'baz']),

Thank you for your reply. I’m still getting the same error, even with the change I made using createSet.

I figured out my mistake it was the issue with the Key: {uuid}, I had not defined that in the schema, it was defined as id.
@RobertBrewitz Thank you for your help.

1 Like