serverless / serverless-python-requirements

⚡️🐍📦 Serverless plugin to bundle Python packages
MIT License
1.11k stars 290 forks source link

When sls pips requirements.txt, lambda embeds "back-slash" into the filename instead of using as folder delimiter #263

Open mannharleen opened 5 years ago

mannharleen commented 5 years ago

Setup

Environment:

OS: Windows 8 sls version: 1.30.1 python: 3.6 VirtualBox: 5.2.8

snippets from serverless.yml

pythonRequirements: dockerizePip: non-linux plugins:

requirements.txt

jsonschema==2.6.0

sls deploy output

Produces the zip for the lambda as desired. The zip file looks like this:

image

All looks good here, until -->

I get the error "module not found" and look at AWS console to find the lambda as: image

Problem!

You saw it there.. the file names contain the backslashes!


Updates:

1:

Issue doesn't exist if I manually zip the files (src and jsonschema folders) and upload into lambda

2:

Issues stays even if I use " dockerizePip: false "

. i.e. Not using the docker container and having sls run the pip command in windows environment. Looks like: Problem in the way zip file is being produced.

dschep commented 5 years ago

@kichik @heri16 have you seen this sort of error?

kichik commented 5 years ago

Sounds like the zip library has a bug? Has its version changed?

TimLudwinski commented 5 years ago

May be related to this issue: https://github.com/serverless/serverless/issues/5172

AndrewFarley commented 4 years ago

Adding a label for visibility and proposing to close for now if this can not be replicated with the latest versions of this plugin and the serverless framework.

sondreslathia commented 4 years ago

Environment: Operating System: win32 Node Version: 12.18.2 Framework Version: 1.78.1 Plugin Version: 3.7.0 SDK Version: 2.3.1 Components Version: 2.34.3

Snip from serverless.yml: plugins:

I am experiencing the same issue. it seems to be due to zipTree.js not handling the correct folder separator and defaulting to using the same as path. This provides the os native separator which is "\" on windows. It seems that this breaks the unzipping function in AWS Lambda since it dosen't correct the behavior when using windows style folder separator.