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

Question: When using layer is noDeploy option respected?

Open tgjorgoski opened this issue 4 years ago • 6 comments

I ask because I have the following configuration, which works fine:

custom:
  pythonRequirements:
    useStaticCache: false # set to false, to force update
    noDeploy:
      - botocore
      - boto3
      - botostubs
      - typing # imorted from a specific library creates issues with python3.8 
    dockerizePip: true
    slim: true
    strip: false

And things work fine, however if I add layer: true It seems that I'm getting the error from the typing library.

Here is the error:

{"errorMessage": "type object 'Callable' has no attribute '_abc_registry'", "errorType": "AttributeError", "stackTrace": [" File "/var/lang/lib/python3.8/imp.py", line 234, in load_module\n return load_source(name, filename, file)\n", " File "/var/lang/lib/python3.8/imp.py", line 171, in load_source\n module = _load(spec)\n", " File "", line 702, in _load\n", " File "", line 671, in _load_unlocked\n", " File "", line 783, in exec_module\n", " File "", line 219, in _call_with_frames_removed\n", " File "/var/task/handler.py", line 5, in \n import rsa\n", " File "/opt/python/rsa/init.py", line 24, in \n from rsa.key import newkeys, PrivateKey, PublicKey\n", " File "/opt/python/rsa/key.py", line 35, in \n import typing\n", " File "/opt/python/typing.py", line 1359, in \n class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):\n", " File "/opt/python/typing.py", line 1007, in new\n self._abc_registry = extra._abc_registry\n"]}

(BTW, I also specify the required changes to the lambda, so it is using the layer:

layers:
      - { Ref: PythonRequirementsLambdaLayer }

tgjorgoski avatar Dec 13 '20 09:12 tgjorgoski

+1 for visibility

markkvdb avatar Sep 24 '21 13:09 markkvdb

+1

gregoryjose avatar Nov 04 '21 13:11 gregoryjose

+1

ghost avatar Nov 17 '21 01:11 ghost

+1

haguirrear avatar Dec 01 '21 02:12 haguirrear

+1. My zipped layer is too big since it's not respecting the noDeploy option and including very large packages (botocore, etc.) that are already available on lambda

FMurray avatar Jan 27 '22 01:01 FMurray

I've also hit this wall - would be great if the above PR (#759) could be reviewed

emann avatar Mar 29 '23 23:03 emann