title: AWS Lambda function works fine when invoked manually, but not through endpoint
body: <p>I have a Lambda function, attached to an API Gateway endpoint, that lists the items under an ID in DynamoDB.</p>
  
  <p>I've built my function using the Serverless Framework. When I invoke the function locally (<code>serverless invoke local ...</code>) it works fine. When I test it manually on the AWS Lambda console, it works fine, but when I call it from the API Gateway, it doesn't work.</p>
  
  <p>It's configured to use this payload: (What I've used for testing)</p>
  
  <pre><code>{
      "requestContext": {
          "identity": {
              "cognitoIdentityId": "468648c5-b135-4075-910a-8a648d66e67d"
          }
     }
  }
  </code></pre>
  
  <p>In my app, I use the <code>aws-amplify</code> package. This is how I call the endpoint:</p>
  
  <pre><code>data = await API.get('endpoint-name', '/endpoint', {
      body: {
          requestContext: {
              cognitoIdentityId: '468648c5-b135-4075-910a-8a648d66e67d'
          }
      }
  });
  </code></pre>
  
  <p>Here, I get a <code>403</code> error. If I call it without the extra data, i.e:</p>
  
  <pre><code>data = await API.get('endpoint-name', '/endpoint');
  </code></pre>
  
  <p>I get an empty list <code>[ ]</code>, but no error. Does <code>aws-amplify</code> automatically populate the <code>cognitoIdentityId</code> field? I'm following the <a href="http://serverless-stack.com/" rel="nofollow noreferrer">serverless-stack</a> tutorial, and they kinda gloss over this.</p>
  
  <p>I also have <code>CloudWatch</code> set up, and I cannot see anything funky there. Any ideas on how to fix / debug this issue?</p>
  
  <p>Cheers!</p>