Closed
Description
Use 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