Skip to content

serverless package should not attempt to follow symlinks in excluded directories #6890

Open

Description

@jleclanche

Reproduce by creating a serverless.yml with the following included:

package:
  exclude:
    - example/

And then creating an example/ dir and a broken symlink inside it, eg. mkdir example/; ln -s /does/not/exist example/broken.

Running serverless package on this will cause an ENOENT error.

  Error: ENOENT: no such file or directory, open '/home/adys/src/_/web/scripts/broken_symlink'
      at Package.getFileContent (/home/adys/.local/share/yarn/global/node_modules/serverless/lib/plugins/package/lib/zipService.js:134:15)
      at Package.getFileContentAndStat (/home/adys/.local/share/yarn/global/node_modules/serverless/lib/plugins/package/lib/zipService.js:123:12)
      at Array.map (<anonymous>)
      at WriteStream.<anonymous> (/home/adys/.local/share/yarn/global/node_modules/serverless/lib/plugins/package/lib/zipService.js:92:46)
      at WriteStream.emit (events.js:210:5)
      at WriteStream.EventEmitter.emit (domain.js:476:20)
      at /home/adys/.local/share/yarn/global/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:231:14
      at /home/adys/.local/share/yarn/global/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:258:16
      at FSReqCallback.oncomplete (fs.js:146:23)

Activity

  1. jleclanche commented on Oct 26, 2019

    @jleclanche
    Author

    Incidentally, excluded directories should be skipped. I have a directory under exclude that contains tens of millions of files and it's causing serverless to hang for hours and run OOM.

  2. medikoo commented on Oct 28, 2019

    @medikoo
    Contributor

    This should definitely be fixed with: #6580

    Still interim patch for current packaging implementation is welcome.

  3. jleclanche commented on Oct 28, 2019

    @jleclanche
    Author

    @medikoo Agreed, and I guess with whatever fixes that we should make sure the exclude directory is skipped.

  4. medikoo commented on Oct 28, 2019

    @medikoo
    Contributor

    I guess with whatever fixes that we should make sure the exclude directory is skipped.

    Yes, there's no point to inspect excluded directories. If it happens, it's already a sign of some inefficiency

  5. thewizarodofoz commented on Mar 10, 2020

    @thewizarodofoz
    Contributor

    @medikoo can you share an update on this please?

  6. medikoo commented on Mar 16, 2020

    @medikoo
    Contributor

    @thewizarodofoz #6580 is on a todo list as one of the priorities, but delivery date is uncertain, and I wouldn't expect that soon.

    Anyway if you can come up with a fix that patches current implementation PR is definitely welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions