Tuesday 14 March 2017

DynamoDB list_append work in console get error in node.js

In my case when I have execute this in my console:

aws dynamodb update-item --endpoint-url http://localhost:8000 --table-name testing --key '{"id": {"N": "4"}}' --update-expression 'SET cosas = list_append(cosas,:s)' --expression-attribute-values '{":s":{"L":[{"N":"8778789"}]}}'

works with out any problem, but when I try the same in node with the code:

var params = {
  "TableName": "testing",
  "Key": {
    "id": {
        "N": "4"
    }
  },
  "UpdateExpression": "SET #attrName = list_append(#attrName,:attrValue)",
  "ExpressionAttributeNames" : {
    "#attrName" : "cosas"
  },
  "ExpressionAttributeValues": {
    ":attrValue": {
        "L": [
            {
                "N": "1489401606520"
            }
        ]
    }
 }
};

I get this error:

    docClient.updateItem(params, function(err, data) {
      ^
 TypeError: docClient.updateItem is not a function
at Object.<anonymous> (/Users/grissom/tweetbinder/src/playground/007_aws/003_dynamodb_button/ButtonLoadData.js:61:11)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3



via Fco Javier Snchez-Ostiz Erviti

No comments:

Post a Comment