Good question, @jonsmirl. I don’t think the AWS docs are clear on this.
context object you’re referring to there is actually included within the
event object under a key of
requestContext. Thus, to get the
context.identity.cognitoIdentityId, you’ll need to access
It’s hard to find this in the AWS docs, so I usually go to the Serverless docs here to see an example event from API Gateway.
Can you let me know if that works for you? If it doesn’t, can you let me know the integration type you’re using for API Gateway (e.g. lambda-proxy, http, http-proxy)?