The error message is indicating that the "requests" module, which is a third-party Python library used for making HTTP requests, is not installed in the AWS Lambda environment.
To resolve this issue, you can add the "requests" package to the deployment package that you upload to AWS Lambda. You can do this by either including the package in the same folder as your Lambda function code and zipping the entire folder, or by using a package manager like pip to create a package specifically for your Lambda function.
Here are the steps to add "requests" package:
python3 -m venv my-lambda-env
source my-lambda-env/bin/activate
pip install requests
mkdir lambda-deploy
cp lambda_file.py lambda-deploy/
pip install -r requirements.txt -t lambda-deploy/
cd lambda-deploy
zip -r ../lambda-deploy.zip *
Asked: 2021-07-10 11:00:00 +0000
Seen: 8 times
Last updated: Sep 21 '21