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

Included files not packaged #5609

Open
raym0nd93 opened this issue Dec 17, 2018 · 10 comments
Open

Included files not packaged #5609

raym0nd93 opened this issue Dec 17, 2018 · 10 comments

Comments

@raym0nd93
Copy link
Contributor

This is a Bug Report

Description

  • What went wrong?

When deploying serverless functions(packaged individually), included files are ignored(except for package.json, package-lock.json and node_modules).

  • What did you expect should have happened?

The files stated under include: should be included. This does work in version 1.34.1

  • What was the config you used?
package:
  individually: true
  include:
    - ../_helpers/logging.js
    - node_modules/**
    - package.json
    - package-lock.json
  exclude:
    - '*/**'
  • What stacktrace or error message from your provider did you see?

No error message is provided, but the files are ignored

Similar or dependent issues:

Additional Data

  • Serverless Framework Version you're using:
    1.35.0
  • Operating System:
    Ubunut 18.04.1
  • Stack Trace:
  • Provider Error messages:
@MacMcIrish
Copy link

Likely fixed by #5602

@dschep
Copy link
Contributor

dschep commented Dec 19, 2018

Yup. Please upgrade to v1.35.1 and let us know if your issue is resolved

@sarangen2
Copy link

v1.35.1 has the same packaging issue. works fine with v1.34.1

@MacMcIrish
Copy link

@sarangen2 I've tried to reproduce this locally, but it seems to be working as expected for v1.35.1 with the ../_helpers/logging.js being packaged.

Is there any more information you can provide?

@magic2
Copy link

magic2 commented Jan 7, 2019

Got similar issue and had to downgrade to 1.34.1. After digging into the code it turned out there is a mismatch in slashes (we are on Windows):

In packageService.js the allFilePaths returned by globby with ** contains paths with forward slashes;

While all patterns, as for they are generated differently (first npm ls ... in zipService.js, then path.join on top of these values), contain paths with backward slashes.

It seems like globby itself was able to match them but after 1.35.0 all pattern matching has been delegated to nanomatch which is not able to handle it as it seems.

dschep added a commit that referenced this issue Jan 7, 2019
This should fix #5609 by using \ on windows instead of /
dschep added a commit that referenced this issue Jan 7, 2019
This should fix #5609 by using \ on windows instead of /
@dschep
Copy link
Contributor

dschep commented Jan 7, 2019

Ahah.. Thanks for mentioning you're on Windows @magic2! I've made a PR that might fix it (sorry, no immediate access to a Windows system to test it myself). Could you test it? npm i -g serverless/serverless#sls-5609

@magic2
Copy link

magic2 commented Jan 7, 2019

Unfortunately, in case of using , slash: path.sep it just takes everything from allFilePaths. I created a small gist to test it out, but it seems like to see the results it must be run on Windows.

@dschep
Copy link
Contributor

dschep commented Jan 7, 2019

Hmm. I'm not surprised that gist doesn't work since you're creating allFilePaths with / in the paths. I guess part of the question is, what kind of paths does globby(['**']) return on windows?

@magic2
Copy link

magic2 commented Jan 8, 2019

Just checked - it returns all paths with forward slashes.

I experimented a bit with other patterns, it seems on Windows globby can handle both forward and backward slashes as part of input pattern(s), but still returns paths with forward slashes.

@dschep
Copy link
Contributor

dschep commented Jan 8, 2019

Thanks. Gonna close my PR then since obviously it won't work then.

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

Successfully merging a pull request may close this issue.

6 participants