Description
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
- This feature request meets Lambda Powertools TenetsShould this be considered in other Lambda Powertools languages? i.e. Java, TypeScript
Activity
michaelbrewer commentedon Apr 21, 2022
@gwlester it is pretty much the same as http api. And for now, even though i would like to resolve this, things are on a pause until August. Until then check what i mentioned elsewhere
gwlester commentedon Apr 21, 2022
@michaelbrewer -- thanks for the "work around"!
michaelbrewer commentedon May 3, 2022
The closet to
official
from AWS in the aws lambda go library:Request:
Response:
Go source:
heitorlessa commentedon Jun 13, 2022
Hey @gwlester we'll be looking in implementing official support for Lambda Function URL as soon as our pause ends.
rubenfonseca commentedon Jul 28, 2022
Hi @gwlester! We're looking to start implementing this feature for release at the end of the next week. We would love if you had the change to contribute the necessary changes yourself. Otherwise, we will also be happy to take a look and ask you for a review. What would be the best for you?
gwlester commentedon Jul 28, 2022
rubenfonseca commentedon Aug 3, 2022
Hi @gwlester we've now worked on an implementation of the AWS Lambda Function URL data class and event handler here: #1408
We would appreciate if you take a look and review the code. And we're looking forward to any feedback you might have.
heitorlessa commentedon Aug 8, 2022
Closing as it was released in 1.27.0
github-actions commentedon Aug 8, 2022
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.