title: Get Thing Shadow of Aws iot thing in lambda function
body: <p>I was trying to get the thing shadow of a resource of aws iot in lambda function but the given code is giving null value on success instead of a data. Please let me know where is the problem and what changes should i do to make it work fine. Thanks in advance.          </p>
  
  <pre><code>var AWS=require('aws-sdk');
  var iotdata = new AWS.IotData({endpoint: 'XXXXXXXXX.iot.us-east-1.amazonaws.com'});
  var params = {
  thingName: 'thing_name' /* required */
  };
  
  exports.handler=function(event,context){
  payload1=new Buffer(event.payload);
  console.log(payload1); 
  iotdata.getThingShadow(params, function(err, data) {
    if (err) console.log(err, err.stack); // an error occurred
    else     console.log(data);           // successful response
  
    context.succeed(data);
  
  });
  
  };
  </code></pre>