title: AWS Lambda seems exiting before completion
body: <p>I have a very simple lambda function (nodeJS) which put the event received in kinesis stream. Here is the source code:</p>
  
  <pre class="lang-js prettyprint-override"><code>
      'use strict';
  
      const AWS = require('aws-sdk');
      const kinesis = new AWS.Kinesis({apiVersion: '2013-12-02'});
  
      exports.handler = async (event, context, callback) =&gt; {
          let body = JSON.parse(event.body);
          let receptionDate = new Date().toISOString();
          let partitionKey = "pKey-" + Math.floor(Math.random() * 10);
  
          // Response format needed for API Gateway
          const formatResponse = (status, responseBody) =&gt; {
              return {
                  statusCode: status,
                  headers: { "Content-Type": "application/json" },
                  body: JSON.stringify(responseBody)
              }
          }
  
          // body.events is an array of events. Just add the reception date in each events.
          for(let e of body.events) {
              e.reception_date = receptionDate;
          }
  
          console.log("put In kinesis stream");
          let kinesisParams = {
              Data: new Buffer(JSON.stringify(body) + "\n"),
              PartitionKey: partitionKey,
              StreamName: 'event_test'
          };
  
          kinesis.putRecord(kinesisParams, (err, res) =&gt; {
              console.log("Kinesis.putRecord DONE");
              if(err) {
                  console.log("putRecord Error:", JSON.stringify(err));
                  callback(null, formatResponse(500, "Internal Error: " + JSON.stringify(err)));
              } else {
                  console.log("putRecord Success:", JSON.stringify(res));
                  callback(null, formatResponse(200));
              }
          });
      };
  
  </code></pre>
  
  <p>When this code is executed, here are the logs in cloudwatch:</p>
  
  <pre><code>START RequestId: 5d4d7526-1a40-401f-8417-06435f0e5408 Version: $LATEST
  2019-01-11T09:39:11.925Z    5d4d7526-1a40-401f-8417-06435f0e5408    put In kinesis stream
  END RequestId: 5d4d7526-1a40-401f-8417-06435f0e5408
  REPORT RequestId: 5d4d7526-1a40-401f-8417-06435f0e5408  Duration: 519.65 ms Billed Duration: 600 ms     Memory Size: 128 MB Max Memory Used: 28 MB  
  </code></pre>
  
  <p>It seems that kinesis.putRecord is not called... I don't see anything in kinesis stream logs. I'm certainly wrong somewhere, but I don't know where !</p>