API Gateway lambda proxy integration not passing identity or authorizer to Golang lambda

0

I have a golang lambda, behind an api gateway, using the Lambda proxy integration. The api gateway uses and authorizer backed by a cognito user pool.

When looking at the request that comes through to the lambda, neither the Identity details, or Authorizer map are populated (seen in this link https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format, and in code https://github.com/aws/aws-lambda-go/blob/main/events/apigw.go#L42), so there is no way to tell what user has made the request.

As it's a lambda integration, I cannot alter the integration request in any way (that I can see).

Is this a bug? Where am I meant to get these details from on the lambda side? Am I looking in the wrong place?

1 Answer
-1

Hi,

The identity part of the mapped request provides you with the info that you're after-

Based on your link: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format

"identity": {
      "accessKey": null,
      "accountId": null,
      "caller": null,
      "cognitoAuthenticationProvider": null,
      "cognitoAuthenticationType": null,
      "cognitoIdentityId": null,
      "cognitoIdentityPoolId": null,
      "principalOrgId": null,
      "sourceIp": "IP",
      "user": null,
      "userAgent": "user-agent",
      "userArn": null,
      "clientCert": {
        "clientCertPem": "CERT_CONTENT",
        "subjectDN": "www.example.com",
        "issuerDN": "Example issuer",
        "serialNumber": "a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1:a1",
        "validity": {
          "notBefore": "May 28 12:30:02 2019 GMT",
          "notAfter": "Aug  5 09:36:04 2021 GMT"
        }
      }
    },

Best,

Didier

profile pictureAWS
EXPERT
answered a month ago
  • The question is about this information not being populated.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions