Feature request: Add Event handler for AWS Lambda Function URLs
See original GitHub issueUse case
With the general availability of AWS Lambda Function URLs to implement microservices AWS Lambda Powertools for Python should support handling this event type.
This should support the routes being specified in a separate file just like for other event handlers.
Solution/User Experience
from aws_lambda_powertools import Logger, Tracer
from aws_lambda_powertools.logging import correlation_paths
from aws_lambda_powertools.event_handler import FunctionUrl
tracer = Tracer()
logger = Logger()
app = FunctionUrl()
@app.get("/hello")
@tracer.capture_method
def get_hello_universe():
return {"message": "hello universe"}
# You can continue to use other utilities just as before
@logger.inject_lambda_context(correlation_id_path=correlation_paths.FUNCTION_URL)
@tracer.capture_lambda_handler
def lambda_handler(event, context):
return app.resolve(event, context)
Alternative solutions
No response
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Java, TypeScript
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:12 (11 by maintainers)
Top Results From Across the Web
Creating and managing Lambda function URLs
Configure a Lambda function URL to assign an HTTP(S) endpoint to your Lambda function without having to integrate with other AWS services.
Read more >Lambda function URLs - AWS Documentation
A function URL is a dedicated HTTP(S) endpoint for your Lambda function. You can create and configure a function URL through the Lambda...
Read more >Invoking Lambda function URLs - AWS Documentation
Invoke your Lambda function through a dedicated HTTP(S) endpoint using a web browser, curl, Postman, or any HTTP client.
Read more >Receiving events using AWS Lambda function URLs
Your Amazon EventBridge event bus can use an AWS Lambda function URL created by an AWS CloudFormation template to receive events from supported...
Read more >Tutorial: Creating a Lambda function with a function URL
Copy the following code example into a file named index. · Create a deployment package. · Add a resource-based policy to your function...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, I will just wait for a status change on this or to hear back from ya’ll.
@michaelbrewer – after looking at the code last night it looked like it would “just work”. It would still be nice to have an explicit class for it.
I know ya’ll did some work on this already – would you mind/like if I took a crack and submitted a Pull Request with it (assuming that I have time before August)?