Skip to content

Feature request: Add HttpResolverAlpha to run Event Handler APIs locally with ASGI servers #7912

@leandrodamascena

Description

@leandrodamascena

Use case

Event Handler resolvers only work with Lambda event payloads. To test APIs locally, you need SAM CLI with Docker or deploy to AWS.

I want to run my API locally with uvicorn like I do with frameworks like FastAPI, Flask, and others.

Solution/User Experience

New HttpResolverAlpha that implements the ASGI specification:

from aws_lambda_powertools.event_handler import HttpResolverAlpha

app = HttpResolverAlpha(enable_validation=True)

@app.get("/hello/<name>")
def hello(name: str):
    return {"message": f"Hello, {name}!"}

# Run locally: uvicorn app:app --reload
# Deploy to Lambda: handler = app

ASGI is the industry standard for Python web apps (same spec FastAPI, Starlette, and Django use). Works with any ASGI server like uvicorn, hypercorn, daphne, or granian. No need to reinvent HTTP handling - we leverage existing battle-tested servers. Also async-ready for future improvements.

This enables faster local development without Docker or AWS deployment.

This must be an Alpha version yet.

Alternative solutions

SAM CLI
LocalStack

Acknowledgment

Metadata

Metadata

Projects

Status

Working on it

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions