When I try to upload the FastAPI on the lambda function I get this error. Would anyone be able to help me with this?
My Porject structure :
README.md
main.py
requirements.txt
routes/api.py
src/dependencies/config.py
src/endpoints/textGenerator.py
My main.py :-
from fastapi import FastAPI,Depends
from routes.api import router as api_router
from mangum import Mangum
app = FastAPI()
app.include_router(api_router)
handler = Mangum(app=app)
{
"errorMessage": "The adapter was unable to infer a handler to use for the event. This is likely related to how the Lambda function was invoked. (Are you testing locally? Make sure the request payload is valid for a supported handler.)",
"errorType": "RuntimeError",
"stackTrace": [
" File \"/opt/python/mangum/adapter.py\", line 76, in call\n handler = self.infer(event, context)\n",
" File \"/opt/python/mangum/adapter.py\", line 68, in infer\n raise RuntimeError( # pragma: no cover\n"
]
}
When I try to upload the FastAPI on the lambda function I get this error. Would anyone be able to help me with this?
My Porject structure : README.md main.py requirements.txt routes/api.py src/dependencies/config.py src/endpoints/textGenerator.py
My main.py :-
{ "errorMessage": "The adapter was unable to infer a handler to use for the event. This is likely related to how the Lambda function was invoked. (Are you testing locally? Make sure the request payload is valid for a supported handler.)", "errorType": "RuntimeError", "stackTrace": [ " File \"/opt/python/mangum/adapter.py\", line 76, in call\n handler = self.infer(event, context)\n", " File \"/opt/python/mangum/adapter.py\", line 68, in infer\n raise RuntimeError( # pragma: no cover\n" ] }