components
components copied to clipboard
`deploy` doesn't preserve file permissions
I have an executable file that has executable permissions, set with chmod +x
.
When spawning that file with Node.js locally, everything works perfect.
As soon as I deploy this with [email protected]
, the permissions are gone and the file can't be executed anymore.
This looks like a regression, about 6 months ago it at least worked, but I didn't check which specific version introduced it.
Minimal reproduction here: https://github.com/timsuchanek/express-serverless-reproduction
We're blocked by this with Prisma Client, as we rely on executing a file: https://github.com/prisma/prisma-client-js/issues/751
You can find a more extensive reproduction here, but the minimal one should be sufficient: https://github.com/leungandrew/nexus-prisma-serverless-express
Thanks for reporting! 😊 ... Hmmm this is odd. I think it might be related to packaging. We are using ADM ZIP under the hood to create the packages. Maybe there's an issue there. We are planning to switch to archiver soon to hopefully overcome this and other issues.
Can confirm that this is an issue with ADM ZIP. Currently, the pack()
method in cli/utils calls zip.addLocalFile(...
. Which calls ADM ZIP's addFile(..
internally and defaults the file permissions to 0644.
See: https://github.com/cthackers/adm-zip/blob/c87b9834c8794728e8b93b0df9669b041f77fe6e/adm-zip.js#L387
Could either switch from addLocalFile
back to addFile
or to Archiver as @eahefnawy has suggested.
Is there any workaround available for this ?
@mehdyouras this should now be fixed. Are you still seeing this issue?
@eahefnawy This is not related to Serverless Components, but we are currently experiencing this issue when trying to deploy a very simple JavaScript lambda. The packaged files are not retaining the permissions set on the source files.