- 최신
- 최다 투표
- 가장 많은 댓글
By default, the Lambda engine calls your function and is looking for an entry point like:
def lambda_handler(event, context):
# your code goes here
You can see this when you create a new Python function.
If you're concerned about keeping your function warm, Lambda provisioned concurrency is normally a better way to go.
I recently faced a similar issue and the solution is provided at https://repost.aws/questions/QU0A9xe6i_T6CfOWLeiWm4XA/api-gateway-with-lambda-unable-to-import-module-server-no-module-named-server
An example of handler is located at https://github.com/fortejas/example-serverless-python-api/blob/main/lambda-api/server.py
handler = Mangum(app)
You would also need to install the required python dependencies
Sample commands
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3.7 get-pip.py
python -m pip --version
rm get-pip.py
pipenv
cd lambda-api/
virtualenv -p /usr/bin/python3.7 vpy37
source vpy37/bin/activate
pip3 install fastapi
pip3 install boto3
pip3 install Magnum
pip3 install uvicorn
I have installed all dependencies but error continues
Would you be able to post your code to a git repo/pastebin and provide the steps on how to reproduce the issue?
관련 콘텐츠
- AWS 공식업데이트됨 일 년 전
I used this approach but got this error Execution failed due to configuration error: Malformed Lambda proxy response. My app works fine with mangum but problem on schedule event.