serverless-python-requirements
serverless-python-requirements copied to clipboard
Lambda cannot find handler file after adding Layers
I am using flask. I would like to add layers to install the requirements using the serverless-python-requirements package by setting layer: true.
My project structure is as follows:
root
- src
- api
- app.py
- api
- requirements.txt
- servereless.yml
Content of serverless.yml is:
service: example
provider:
name: aws
runtime: python3.7
plugins:
- serverless-wsgi
- serverless-python-requirements
functions:
api:
handler: wsgi_handler.handler
package:
include:
- "./src/api/**"
layers:
- { Ref: PythonRequirementsLambdaLayer }
events:
- http: ANY /
- http: ANY {proxy+}
custom:
wsgi:
app: "src/api/app.app"
packRequirements: false
pythonBin: python
pythonRequirements:
layer: true
....
As per the above configuration, I am getting this error:
Lambda can't find the file wsgi_handler.py. Make sure that your handler upholds the format: file-name.method.
Any help is highly appreciated. Thanks in advance.
did you try changing wsgi_handler.handler to app.handler or changing app.py to wsgi_handler.py