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 年前1068 查看次数
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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则