I am trying to deploy a python lambda function using serverless. I need the psycopg2 library so I used the serverless-python-requirements plugin and added it to my serverless.yml file.
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: non-linux
I can deploy the function successfully:
Serverless: Installing requirements from
/Users/Desktop/postgresql/.serverless/requirements/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.6
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (43.07 MB)...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
..............
Serverless: Stack update finished...
But when I check my Cloudwatch logs, it says that there is "No module named 'psycopg2' ".
The structure of my zip file is:
|--node_modules
|--.gitignore
|--handler.py
|--package-lock.json
|--package.json
|--serverless.yml
No .serverless/ dir was created when I ran serverless deploy...
Any help would be greatly appreciated!