handler not found in main.py {lambda function }

0

"errorMessage": "Handler 'handler' missing on module 'main'", "errorType": "Runtime.HandlerNotFound",

Code : from fastapi import FastAPI from mangum import Mangum

app = FastAPI()

@app.get("/") def root(): return {"message":"Hello world"}

handler = Mangum(app,)

IN lambda function main.py file . how to resolve?

abhay
已提問 2 年前檢視次數 1047 次
1 個回答
0

Hi, @abhay

You need to provide a dedicated handler there, import main.py and initialize Mangum.

Let's prepare handler = Mangum (app,) separately.

Please refer to the link below.
https://qiita.com/araki-yzrh/items/985015b9e08978e95b16

profile picture
專家
iwasa
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南