-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slim_handler: true fails in Windows, possibly due to file slashes in tarball #2145
Comments
I note that the reasoning for using a tarball is discussed in #1022 and #1037. Since the file slash issue is fundamental to the tarfile python module, and there are good reasons for using a tarfile (streamed unzipping to/tmp seems to be the primary one), I'll go down the "fix the slashes in the tarball" path. I confirmed that the line Livestream of edits as I try stuff...
Replace the slashes in the tarballTried replacing the slashes in
Listing the tar contents in WSL now shows the correct slashes:
However I am getting the same error. Turn it off and then on againTrying Still failed with Make it a zip file instead of a tar, performance decrease be damned.Edited It looks like many errors were begin suppressed when I had Hooray a new error, now I'm running out of disk space! Forked my repo and made a lighter weight venvThe repo is now right on the edge of size for needing slim_handler. I successfully deployed the code with Still unable to deploy with slim_handler. When I deploy with slim_handler true and lambda_handler commented out I see an error that appears to be related to this issue #1834 (comment) Adding
....even though this project doesn't use a DB. Was greated with a new error: |
I'm giving up for today. It looks like slim_handler is broken, but it's not clear to me why and may not be for the reason I posted about. |
I was able to make it work on Windows Subsystem Linux Ubuntu by creating a new venv, clean installing my requirements and setting the .tar.gz in S3 to public. Obviously this is insecure and won't continue for long, but its an indicator to anyone who lands here to check S3 permissions. Still no luck deploying from Windows, sadly. CloudWatchLogs on Windows:
I'm completely sure that its able to access the .tar.gz |
I was unsuccessful from Win 10, switched over to WSL/the venv for WSL changing nothing else, and successfully deployed from WSL. |
I'm going the WSL route too, but FWIW, I managed to upload a 89Mb package without setting |
It is not possible to use Zappa on Windows with slim_handler = true. This is likely due to the slashes used when tarring the file. This issue is well known, probably easy to fix, and has cropped up in #1870 and #1358 with a PR for #1358 in #1570 that seemed to not get integrated.
Context
Using venv and Python 3.6 on Widows 10, I was able to successfully deploy a project and get the expected results. Upon installing pandas, my lambda project exceeded what Lambda would accept. After
pip install pandas
and the failed deployment I changes zappa_settings.json to addslim_handler : true
, then deployed. I'm now encountering an issue returning the errorerrorMessage": "Unable to import module 'index'"
. Myhandler
function is a regular python function that is inindex.py
and was otherwise working fine.Expected Behavior
Expect this deployment to be successful and return a 200 and some JSON via my API Gateway
Actual Behavior
I receive a 502 {"message": "Internal server error"} from the API Gateway endpoint and
zappa tail
returns many instances of:[1596019020990] Unable to import module 'index': No module named 'index'
. My function is in index.py."lambda_handler": "index.handler",
Possible Fix
Steps to Reproduce
"slim_handler": true, "delete_local_zip": false,
zappa tail
expected output should be something like:Unable to import module <handler_function>: No module named <your import>
tar --list --verbose --file=<project>-<env>-<time>.tar.gz
on Linux. The output, in my case from WSL Ubuntu, proves that there are indeed mixed slashesYour Environment
pip freeze
: I have a bloated pip freeze here, I'm not actually using django for this particular function, but its part of a set of lambdas that are all on the same venv. Posted my requirements.txt for brevity:zappa_settings.json
:EDIT: I noted that this issue doesn't seem to affect the zip file. Running
unzip -l handler_<project>-<env>-<time>.zip
in WSL on the Windows-created handler zip works without issue. See output:The text was updated successfully, but these errors were encountered: