Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Symbolic links dont get put in zip file #124

Closed
latourette359 opened this issue Jun 22, 2017 · 9 comments
Closed

Symbolic links dont get put in zip file #124

latourette359 opened this issue Jun 22, 2017 · 9 comments

Comments

@latourette359
Copy link

Please use GitHub issues only to report bugs. To ask a general question or request assistance/support, please use the Claudia.js Gitter Chat instead.

To report a bug or a problem, please fill in the sections below. The more you provide, the better we'll be able to help.


  • Expected behaviour:
    Recently when trying to use claudia to deploy a sharp project to aws lambda, i came across some behavior that i didn't expect. When zipping dependencies, claudia doesn't seem to package symbolic links. node_modules/sharp/vendors/ relies heavily on symbolic links and therefore could not run when being deployed with claudia (without manual alterations to the dependencies.) I expect these symbolic links should be uploaded.

  • What actually happens: symbolic links do not get put into the zip file.

  • Link to a minimal, executable project that demonstrates the problem:
    using claudia to deploy https://github.com/awslabs/serverless-image-resizing

  • Steps to install the project:

  • Steps to reproduce the problem:
    if you package https://github.com/awslabs/serverless-image-resizing with claudia, node_modules/sharp/vendor/libvipps.so.42 will not be in the upload and therefore the lambda function will not run.

@latourette359 latourette359 changed the title Symbolic links don in zip file Symbolic links dont get put in zip file Jun 22, 2017
@latourette359
Copy link
Author

Note: I was able to get it to work by replacing the symbolic links with copies

@gojko
Copy link
Member

gojko commented Jun 24, 2017

Thanks for reporting this. I've investigated the issue and it seems that the dependent library we use (node-archiver) does not support symlinks yet. They will start will start supporting symlinks in the next major version (archiverjs/node-archiver#243), so when that gets released we can update claudia.

Fixing this now would require either changing the library to use for producing the zip files, or contributing upstream to the node archiver and implementing support for symbolic links. Both are too much work for me to pursue now. If you'd like to contribute, this is the function that needs to change: https://github.com/claudiajs/claudia/blob/master/src/tasks/zipdir.js -- please submit a pull request and I'll merge it.

Including symbolic links should be an option rather than something forced, to avoid system libraries being linked in by mistake. (eg check out serverless/serverless#3215)

@gojko gojko closed this as completed Jun 24, 2017
@cameronk
Copy link
Contributor

cameronk commented Jul 7, 2017

archiver/node-archiver#243 has cleared with support for symlinks and archiver package has bumped up to version 2.0.0.

@latourette359
Copy link
Author

latourette359 commented Jul 10, 2017 via email

@kevintechie
Copy link
Contributor

kevintechie commented Nov 20, 2017

This bug should be re-opened because node-archiver still does not handle symlinks correctly and, therefore, claudiajs doesn't create packages with valid symlinks.

@stojanovic
Copy link
Member

It's not node-archiver, it's because of npm pack. We are aware of this, but we are still deciding if it should be handled because then we can't simply do npm pack anymore, and that solves a lot of potential problems.

@kevintechie
Copy link
Contributor

Is the issue being tracked someplace? There still seems to be a fix for a bug in node-archiver that hasn't been released yet: archiverjs/node-archiver#293

@keeganmccallum
Copy link

as a workaround, I used a postinstall script in npm:

"postinstall": "find node_modules/ -type l -exec sed -i '' {} ';'"

the sed method was adapted from here: https://stackoverflow.com/questions/7167424/replace-all-symlinks-with-original

@pkyeck
Copy link

pkyeck commented Feb 15, 2021

can we handle symlinks now? looks like no – still get the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants