title: DynamoDB causing Lambda timeout
body: <p>I am experiencing an issue where Lambda functions occasionally time out without any error message other than a notification that the function timed out.</p>
  
  <p>In order to find the root of the issue, I added logging at various points throughout my function and determined that everything functions properly until the first getItem() request to read data from DynamoDB. The read seems to be taking more than the 3.00 second timeout.</p>
  
  <p>Naturally, I checked my DynamoDB table to see if there were any throttled reads or errors. DynamoDB's metrics show no throttles or errors, and read times remain in the double-digit milliseconds at most.</p>
  
  <p>Clearly something is going wrong or getting dropped along the way. How can I fix this issue or at least catch it and retry the read?</p>
  
  <p>This is a read-oriented function for a web API, so response times are critical. Hence, an increased timeout will not solve the issue.</p>
  
  <pre><code>dynamodb.getItem({
    "TableName": "tablename",
    "Key": { "keyname": { "S": "keyvalue" } },
    "AttributesToGet": [ "attributeA", "attributeB" ]
  }, function(err, data) {
    if(err){
      context.done(err);
    } else {
      if("Item" in data){
        nextFunction(event, context);
      } else {
        context.done("Invalid key");
      }
    }
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dN142.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/dN142.jpg" alt="No throttled reads"></a></p>
  
  <p><a href="https://i.stack.imgur.com/NvhFQ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/NvhFQ.jpg" alt="Read latency appears to be minimal"></a></p>