serverless-python-requirements icon indicating copy to clipboard operation
serverless-python-requirements copied to clipboard

zip: true and layer: true puts requirements zip in both layer and lambda

Open m-radzikowski opened this issue 2 years ago • 2 comments

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

m-radzikowski avatar Jan 12 '22 14:01 m-radzikowski

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

emann avatar Mar 29 '23 19:03 emann

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?

georgek avatar Feb 08 '24 14:02 georgek