amazon web services – aws-sdk dynamodb add fails

The code below fails with the following error message. I don’t see an obvious problem. Am using aws-sdk v3

  "errorType": "TypeError",
  "errorMessage": "Cannot read properties of undefined (reading '0')",
  "trace": [
    "TypeError: Cannot read properties of undefined (reading '0')",
    "    at AttributeValue.visit (/var/runtime/node_modules/@aws-sdk/client-dynamodb/dist-cjs/models/models_0.js:501:40)",
...
const { DynamoDBClient, UpdateItemCommand } = require("@aws-sdk/client-dynamodb");
....
const updateRecipientParams = {
        TableName: 'duckies',
        Key: { userId : "sram"},
        UpdateExpression: 'ADD totalReceived :inc',
        ExpressionAttributeValues: { ':inc': 1},
        ReturnValues: 'UPDATED_NEW',
      };
        const command = new UpdateItemCommand(updateRecipientParams);
        const updatedRecipient = await dynamoDB.send(command);

Read more here: Source link