Closed
Description
Expected Behaviour
returns authorizer dictionary
Current Behaviour
KeyError
Code snippet
powertools-lambda-python/aws_lambda_powertools/utilities/data_classes/api_gateway_proxy_event.py
line 94 in class APIGatewayEventRequestContext
def authorizer(self) -> APIGatewayEventAuthorizer:
return APIGatewayEventAuthorizer(self._data["requestContext"]["authorizer"])
Possible Solution
def authorizer(self) -> APIGatewayEventAuthorizer:
return APIGatewayEventAuthorizer(self.["requestContext"].get("authorizer"))
Steps to Reproduce
@event_source(data_class=APIGatewayProxyEvent)
def handler(event: APIGatewayProxyEvent, context):
authorizer = event.request_context.authorizer
Powertools for AWS Lambda (Python) version
2.36.0
AWS Lambda function runtime
3.11
Packaging format used
PyPi
Debugging logs
No response
Metadata
Metadata
Assignees
Type
Projects
Status
Shipped