-
Notifications
You must be signed in to change notification settings - Fork 293
Description
Hi,
I am trying to deploy my python code on aws lambda using serverless and I am following the below tutorial:
https://serverless.com/blog/serverless-python-packaging/
When I am trying to deploy I get the below error:
Error --------------------------------------------------
Exception:
Traceback (most recent call last):
File "/var/lang/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/var/lang/lib/python3.6/site-packages/pip/commands/install.py", line 388, in run
ensure_dir(options.target_dir)
File "/var/lang/lib/python3.6/site-packages/pip/utils/init.py", line 83, in ensure_dir
os.makedirs(path)
File "/var/lang/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/var/task/.serverless/requirements'
Can anyone help me out with that.
Activity
dschep commentedon Dec 15, 2017
Hmm. interesting. Could you share your
serverless.yml
and what operating system you're on?fshah7 commentedon Dec 15, 2017
Sure. I am on mac os.
Here the serverless.yml file.
Here is the handler.py
dschep commentedon Dec 15, 2017
Hmm. I assume you're using Docker for Mac? Is this project inside your home directory(within
/Users
)?fshah7 commentedon Dec 15, 2017
Yes I am using docker for mac. The project is under my home directory
fshah7 commentedon Dec 15, 2017
Just FYI,
I am following this blog: https://serverless.com/blog/serverless-python-packaging/
and facing the issue when I try serverless deploy
pr130 commentedon Jan 29, 2018
I have the same issue on mac. directory is a subdirectory of my home directory.
This is what our serverless looks like. Weirdly, it works for my colleagues who're on mac os as well, just not for me.
dschep commentedon Jan 29, 2018
How do you & your colleagues have docker installed? My mac using colleagues use Docker for Mac and it works for them. Are you maybe using an older docker on mac technique such as docker-machine or boot2docker?
pr130 commentedon Jan 29, 2018
Thanks for the fast reply. I have Docker for Mac and I think my colleagues have that as well.
I have had some issues with docker itself (long startup, some hangups (needed to restart)) but it's up and running now.
Some other info: I installed the plugin like it is described on the serverless website, not how you guys wrote in the readme. is that relevant?
I also ran the command with debug on and this is the stack trace just in case there's something totally obvious. Tbh, i think it's something with my setup and permissions to my user, so i'll do some more digging into that tomorrow and post what i've found here as at least someone had the same problem.
dschep commentedon Jan 29, 2018
That installation technique is fine, the☹️
sls plugin install
command is a newer addition to serverless. Alas nothing jumps at at me in that trace backmemarsh commentedon Feb 20, 2018
@friep Did you ever find a solution for this problem?
pr130 commentedon Mar 14, 2018
@memarsh no unfortunately not.. i was able to use dockerizePip=false for a while but now I'd really need to use =true because we need to compile stuff. So I'm back to this problem.
bsamuel-ui commentedon Nov 29, 2018
Can anyone following confirm this is still an issue?
ramisvik commentedon Jun 12, 2019
Do we have a solution for this issue?
wichon commentedon Oct 18, 2019
I am having the same issue (Using Fedora 30), the only way that I found to make it work is to extract the generated zip artifact (inside .serverless) change the file permissions, zip it again and manually upload it to the function.
So I guess the file permissions inside the package are somehow inherited by the ones set in the OS. So is there a way to modify this permissions before creating the zip package?
bbock commentedon Jun 24, 2020
I have had similar problems. My
umask
was set to027
, so not world readable, and the Lambda user obviously does not match my UID and GID.I was able to fix permission problems with setting
umask
properly (and removing caches to force file creation in proper mode: