aws/chalice

Incorrect permissions on chalice/app.py and chalice/__init__.py

Opened this issue · 2 comments

When using chalice deploy to deploy a project from Mac OS 11.1, the permissions of files chalice/app.py and chalice/__init__.py that are packaged by chalice are not open enough, leading to the following error:
Screen Shot 2020-12-17 at 9 33 58 PM

If you look at the deployment it becomes apparent that chalice/app.py and chalice/__init__.py do not have 644 permissions as required by lambda:
Screen Shot 2020-12-17 at 9 33 04 PM

I was able to fix this by simply using chmod 644 to change the permissions on chalice source code:
Screen Shot 2020-12-17 at 9 37 35 PM

Now it is packaged with the appropriate level of permissions:
Screen Shot 2020-12-17 at 9 38 00 PM

Not sure what the best way forward would be as far as making sure the permissions are correct by default when installing chalice with pip, but I figured I would at least post this to give a solution for others running in to the same issue.

I believe what's happening is that if you install chalice globally, it uses -rw------- for the chalice library files. We preserve the file permissions when we zip a file so we should be able to special case the built-in chalice files to ensure they're always readable by all.

However, I would recommend using a virtualenv if possible, it should also fix this issue for you.

We are experienced the same issue. Is there a mechanism in Chalice to trigger a script locally prior to creating the zip so that file permissions can be correctly set?