Fook
Fook

Reputation: 5550

DynamoDB updateItem failing

Trying to create a Lambda to update DynamoDB from a Kinesis stream. Here is my update statement:

var response = dd.updateItem({
            'Key': {'S': payload.identityId},
            'TableName': 'Users',
            'UpdateExpression': 'SET testVal = :testVal',
            'ExpressionAttributeValues': {
                ':testVal': {'S': 'This is a test'}
           }
}

That generates 47 error messages:

...

The Users table exists and is currently empty. I've double checked the identityID exists (and is valid). Can anyone see what I'm doing wrong here?

Upvotes: 3

Views: 1977

Answers (1)

Fook
Fook

Reputation: 5550

Figured this out. Sometimes just posting the question makes you think about it differently!

I wasn't passing the Key correctly.

dd.updateItem({
            'Key': {
                'hashAttributeName': {
                    'S': payload.identityId
                }
            },
            'TableName': 'Users',
            'UpdateExpression': 'SET testVal = :testVal',
            'ExpressionAttributeValues': {
                ':testVal': {'S': 'This is a test'}
            }
        }

Upvotes: 6

Related Questions