I’m fairly new to serverless and have been through the forums but do not see an answer or specific question on this. I have the following file structure:
|-- common |-- constants.json |-- serverless |-- project_1 |-- serverless.yml |-- env.yml |-- functions |-- f1 |-- index.py |-- sf1.py |-- requirements.py |-- f2 |-- index.py |-- sf2.py |-- requirements.py
and serverless.yml:service: myservice plugins: - serverless-python.requirements custom: pythonRequirements: zip: true dockerizePip: non-linux provider: name: aws runtime: python3.7 stage: dev environment: ${file(./env.yml):${opt:stage, self:provider.stage}.env} region: ${file(./en> v.yml):${opt:stage, self:provider.stage}.aws.region} profile: ${file(./env.yml):${opt:stage, self:provider.stage}.aws.profile} package: individually: true include: ../../common/constants.json functions: f1: handler: index.handler module: functions/f1 package: include: - functions/f1/** events: - http: path: / method: get f2: handler: index.handler module: functions/f2 package: include: - functions/f2/** events: - http: path: / method: get
index.py
in either references constants.json. I have tried a number of different ways to do this and cannot seem to understand the correct way to include constants.json for all or even for each function under package>include
. I get "errorMessage":"[Errno 2] No such file or directory: 'constants.json'"
.