generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 469
Open
Enhancement
Copy link
Labels
Description
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 = appASGI 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
LocalStackAcknowledgment
- This feature request meets Powertools for AWS Lambda (Python) Tenets
- Should this be considered in other Powertools for AWS Lambda languages? i.e. Java, TypeScript, and .NET
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Working on it