Python library files are not inside folders when deployed to AWS Lambda

Viewed 65

The first screenshot is from a lambda in the AWS console. Why all the files are NOT in its own folders? The screenshot is attached. These filers are from python libraries, somehow the files are out of folders.

The second screenshot is how the folders I am expecting. When I unzip the zip file which got developed to AWS, it looks like the second screenshot.

Screenshot from AWS Lambda

It should show like this in the AWS Lambda console:

I am expecting the files in the folder like this

1 Answers

You most likely used Windows's Compress-archive or something similar to create the zip file for the lambdas. Since the file separator in Windows and Linux are different, the lambda does not recognize the folder structure correctly, and instead it treats them as long file names.

Try to use, for instance 7-Zip, for zipping the files when you are on Windows. That should fix the file separator issue, since 7-zip uses the cross compatible / as the file separator instead of Windows specific \.

Related