claudiajs / claudia

Deploy Node.js projects to AWS Lambda and API Gateway easily
https://claudiajs.com
MIT License
3.8k stars 274 forks source link

feature request, bugfix: Check/Change file permissions before zipping lambda to production to avoid unexpected bugs after successful deploys #151

Closed JustFly1984 closed 6 years ago

JustFly1984 commented 6 years ago

I had an "errorMessage": "EACCES: permission denied" in production after replacing single file in my lambda. It happened that original file had permissions 644, but after replacement file get permissions 600. There was no errors in the file, I checked with eslint. Content of the file is plain JS object with text feilds, so I updated both lambdas - development and production at the same time, without testing it.

I had no idea that file permissions could change, or my local file permissions could transfer to AWS without reseting.

After googling an error code I found this article: https://acloud.guru/forums/aws-lambda/discussion/-KSVv58PhKhA1c6a6EZ-/%22errorMessage%22:%20%22EACCES:%20permission%20denied,%20open%20'~2Fvar~2Ftask~2Fcsv_read.js'%22,

And solved my issue in 2 minutes, but that issue could be prevented by build tool.

Can you please add file permission checking for 644, and if file is not 644, set correct permission, or stop create/update with warning about wrong permissions?

Thank you for great work. I found your tool as best AWS lambda deployment tool.

radix commented 6 years ago

yeah, I think chmodding the temporary files right before zipping should solve this. I just ran into the same issue, because I had a umask of 077 set.

of course, it's silly that AWS is so picky about the file permissions in the zip files it unpacks, but I don't think they're fixing that.

JustFly1984 commented 6 years ago

Is it implemented? I'm interested why this issue closed.

gojko commented 6 years ago

yes, it's implemented. github automatically closes issues when a commit references them. it will be released as part of claudia 5.0.0 over the next few days. if you want to give it a beta-test, install claudia directly from github (so npm install claudiajs/claudia -D) instead of NPM.

JustFly1984 commented 6 years ago

Thank you!

2018-06-05 15:31 GMT+08:00 Gojko Adzic notifications@github.com:

yes, it's implemented. github automatically closes issues when a commit references them. it will be released as part of claudia 5.0.0 over the next few days.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/claudiajs/claudia/issues/151#issuecomment-394610499, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJseW79lgjkEVDWyd9ozYim7YVijXYRks5t5jPRgaJpZM4TYDx8 .