How to use AWS SDK with Promise
<p>At first, I use Simplified Callback Method work fine. Now, I want to use promise to query AWS dynamoDB.
 I refer <a href="https://blogs.aws.amazon.com/javascript/post/Tx3BZ2DC4XARUGG/Support-for-Promises-in-the-SDK" rel="nofollow">this</a>.</p>

<p>But always 500 Internal Server Error.
I use lambda and node.js 4.3. Do I miss something?</p>

<p>Handler.js</p>

<pre><code>let AWS = require('aws-sdk');
AWS.config.setPromisesDependency(null);
docClient = new AWS.DynamoDB.DocumentClient();

module.exports.handler = (event, context, callback) =&gt; {

  const listObjectPromise = docClient.query(params).promise();
  listObjectPromise.then((data) =&gt; {
      return callback(null, data);
  }).catch((err) =&gt; {
      return callback(err, null);
  });
};
</code></pre>