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

Using exclude with no include fails #16

Closed
miketheman opened this issue Apr 5, 2017 · 9 comments
Closed

Using exclude with no include fails #16

miketheman opened this issue Apr 5, 2017 · 9 comments

Comments

@miketheman
Copy link
Contributor

With serverless-python-requirements@2.0.0.

If no include: directive is found, deploy triggers a failure.

https://github.com/UnitedIncome/serverless-python-requirements/blob/7044eeb46c5c0f6c8e74c46d68f36dba5dc6dfff/index.js#L83-L84

Example serverless.yml

package:
  exclude:
    - .git/**

Output

Running SLS_DEBUG=* serverless deploy:

Serverless: Installing required Python packages...
Serverless: Linking required Python packages...

  Type Error ---------------------------------------------

     Cannot read property 'push' of undefined

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

TypeError: Cannot read property 'push' of undefined
    at fse.readdirSync.map.file (/Users/miketheman/project/node_modules/serverless-python-requirements/index.js:83:50)
    at Array.map (native)
    at ServerlessPythonRequirements.linkRequirements (/Users/miketheman/project/node_modules/serverless-python-requirements/index.js:82:40)
    at runCallback (timers.js:666:20)
    at tryOnImmediate (timers.js:639:5)
    at processImmediate [as _immediateCallback] (timers.js:611:5)
From previous event:
    at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:156:22)
    at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:95:31)
    at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:23:50)
    at process._tickCallback (internal/process/next_tick.js:109:7)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

     Please report this error. We think it might be a bug.

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       7.7.4
     Serverless Version: 1.9.0

Workaround

Add an include: with any file you expect to always be part of your deployment package:

package:
  include:
    - requirements.txt
  exclude:
    - .git/**
@miketheman
Copy link
Contributor Author

May be related to some of the code being discussed in #15 - should probably be split from the docker user PR if relevant.

@dschep
Copy link
Contributor

dschep commented Apr 5, 2017

Hmm. That's curious. Could you provide an example or provide more specific direction on how to duplicate this issue. I can't seem to duplicate the issue. Here's the service I used (simply the default aws-python template with requests & this plugin added. https://gist.github.com/dschep/1f2225b7c075e646357adc7ed3593b85

@miketheman
Copy link
Contributor Author

miketheman commented Apr 5, 2017

Your example needs an active package: exclude statement

@dschep dschep closed this as completed in 6c5523c Apr 5, 2017
@dschep
Copy link
Contributor

dschep commented Apr 5, 2017

Perfect. Thank you. Fixed and released as v2.0.1. Good catch! 👍

@miketheman
Copy link
Contributor Author

Thanks!

@cdimitroulas
Copy link

I'm still having this issue in v3.0.5.

I had to add a package: include statement

@dschep
Copy link
Contributor

dschep commented Oct 17, 2017

@cdimitroulas are you using the zip option? looking at the code that code path would have this bug I think.

@miketheman
Copy link
Contributor Author

I have a fix coming up, working on the test case right now.

miketheman referenced this issue in miketheman/serverless-python-requirements Oct 17, 2017
Refs #16
Similar to 6c5523c

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman
Copy link
Contributor Author

PR submitted.

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

3 participants