serverless-python-requirements
serverless-python-requirements copied to clipboard
zip: true and layer: true puts requirements zip in both layer and lambda
With configuration:
custom:
pythonRequirements:
dockerizePip: non-linux
zip: true
layer: true
there are two output zip files - one for Lambda, other for Layer.
The plugin seems to first create ./.requirements.zip
file with all the requirements, then put the content into ./.serverless/pythonRequirements.zip
. Then it generates zip for Lambda function code taking everything from the stack directory and putting it into ./.serverless/fn-name.zip
. It includes the .requirements.zip
file.
Related: #365
Just ran into this myself - is there really ever a reason to have both enabled? I still had zip: true
due to only recently adding layer: true
, but I don't know if theres a situation in which you would want to use both. If nothing else, this should be noted in the docs
I would expect having both enabled would create the pythonRequirements
layer with zipped dependencies, thereby shrinking the size of the layer (and obviously leaving the zipped deps out of the function layer). Is there any reason it doesn't do that?