Skip to content

Feature request: Add Event handler for AWS Lambda Function URLs #1142

Description

@gwlester

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions