AWS.DynamoDB.DocumentClient is not providing data on put

You aren't asking for any values to come back, so why do you expect there to be any values coming back? You'll need to set the appropriate parameters ReturnConsumedCapacity and/or ReturnItemCollectionMetrics and/or ReturnValues if you are wanting any of that to come back in the response.


As you can't set a value for "ReturnValues" that actually returns anything useful, I worked around it by simple passing back the original item data that was passed in.

import * as AWS from "aws-sdk";


AWS.config.update({
  region: "us-west-2",
  endpoint: "http://localhost:8080"
});


const docClient: any = new AWS.DynamoDB.DocumentClient();


const item = {
      someField:    "456",
      other:         "123"
};

const params = {
  TableName: "TableName",
  Item: item
};

// Have a clear reference to this scope
var self = this;

docClient.put(params, function(err, data) {
  if (err) console.log(err);
  else console.log(self.params.Item); // this should return the data you passed in!
});

I set "self" as "this" to make it clear where I'm reading the data from. Hope that helps someone!