Search code examples
amazon-web-servicesvalidationamazon-dynamodb

Dynamodb table: key schema validation error


Title: Dynamodb table validation error

Here is my code.

const updateParams = {
    TableName: process.env.DYNAMODB_TABLE,
        Key: {
          'partitionKey': item.partitionKey,
          'sortKey': item.sortKey,
      'couponID': item.couponID,
        },
        UpdateExpression: 'set field = :field',
        ExpressionAttributeValues: {
          ':field': fieldValue 
        }
    await docClient.update(updateParams).promise();
}

But I encountered an issue below.

Error updating job records: ValidationException: The provided key element does not match the schema

I have been struggling with it for 3 days but couldn't solve it. I hope someone help me to fix this issue.

Google I'm expecting someone help me to fix that issue.


Solution

  • I can't understand why you added couponID. There can't be several records with same partitionKey and sortKey in DynamoDB table. It must be unique. Remove couponID and try it once more.