Issue
I have the following CI/CD setup with Gitlab for deploying my lambda function
src="https://i.stack.imgur.com/mbOg1.png" alt="enter image description here" />
When it runs no error happens but when I try executing the function I receive the "failed with error [Errno 13] Permission denied: '/var/task/lambda_function.py" error. Is there any way to solve this? I've found this article in which aws suggests using chmod to give file permissions, but it didn't help.
BTW: I've ran the same commands locally in my machine and no error happens when running the function
Thanks in advance for any answer.
UPDATE: CloudWatch Logs below
Solution
I think you have similar trouble like this one and another here on stackoverflow as well. You have to manually set the permissions of the zip file.
quoting from the bug
The zip archive preserves file permissions, so if you have a 644 permissions file, deflate it and inflate it back up, you get 644 permissions for that file.
So to fix the issue, simply set the expected permissions before deflation, in Lambda's case, something like 755 will do.
Answered By - samtoddler Answer Checked By - Marilyn (WPSolving Volunteer)