Skip to content

Feature request: Add Event Source Data Class for AWS Lambda Function URLs #1141

Closed
@gwlester

Description

@gwlester

Use case

With the general availability of AWS Lambda Function URLs to implement microservices AWS Lambda Powertools for Python should support this event type.

While I can not find a formal definition of what the event can look at, here is a sample:
{'version': '2.0', 'routeKey': '$default', 'rawPath': '/favicon.ico', 'rawQueryString': '', 'headers': {'sec-fetch-mode': 'no-cors', 'referer': 'https://c3zn6zdoafuxiztw6peqnbnflm0mywcm.lambda-url.us-east-1.on.aws/', 'sec-fetch-site': 'same-origin', 'accept-language': 'en-US,en;q=0.9', 'x-forwarded-proto': 'https', 'x-forwarded-port': '443', 'x-forwarded-for': '98.164.126.35', 'accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8', 'sec-ch-ua': '\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"100\", \"Google Chrome\";v=\"100\"', 'sec-ch-ua-mobile': '?0', 'x-amzn-trace-id': 'Root=1-6260d9a0-4156ec632c4ba12352c4ff3a', 'sec-ch-ua-platform': '\"Linux\"', 'host': 'c3zn6zdoafuxiztw6peqnbnflm0mywcm.lambda-url.us-east-1.on.aws', 'accept-encoding': 'gzip, deflate, br', 'sec-fetch-dest': 'image', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36'}, 'requestContext': {'accountId': 'anonymous', 'apiId': 'c3zn6zdoafuxiztw6peqnbnflm0mywcm', 'domainName': 'c3zn6zdoafuxiztw6peqnbnflm0mywcm.lambda-url.us-east-1.on.aws', 'domainPrefix': 'c3zn6zdoafuxiztw6peqnbnflm0mywcm', 'http': {'method': 'GET', 'path': '/favicon.ico', 'protocol': 'HTTP/1.1', 'sourceIp': '98.164.126.35', 'userAgent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36'}, 'requestId': '1e5fa2e6-65a2-474a-96f6-4c9858b0943f', 'routeKey': '$default', 'stage': '$default', 'time': '21/Apr/2022:04:12:16 +0000', 'timeEpoch': 1650514336041}, 'isBase64Encoded': False}

Please note that the path to the lambda is effectively /*.

Solution/User Experience

`
from aws_lambda_powertools.utilities.data_classes import event_source, FunctionUrlEvent

@event_source(data_class=FunctionUrlEvent)
`

Alternative solutions

No response

Acknowledgment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions