Skip to content

General requirements.txt while using Per-function requirements #174

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

Closed
amitm02 opened this issue Apr 16, 2018 · 6 comments
Closed

General requirements.txt while using Per-function requirements #174

amitm02 opened this issue Apr 16, 2018 · 6 comments

Comments

@amitm02
Copy link

amitm02 commented Apr 16, 2018

Can i keep a general requirements.txt file in the root folder for all general functions and an additional unique requirements.txt for a specific function in a module folder?
e.g

├── serverless.yml
├── requirements.txt
├── functions.py
├── specialFunctionWithAdditionalRequirments
│ ├── requirements.txt
│ └── specialFunction.py

package:
  individually: true

functions:
  func1:
    handler:  functions.func1
  func2:
    handler:  functions.func2
 special:
    handler: specialFunction.handler
    module: specialFunctionWithAdditionalRequirments

attempting to do "sls deploy -f func1" in this configuration resulted me in:

Cannot read property 'artifact' of undefined error
TypeError: Cannot read property 'artifact' of undefined
    at values.forEach (.../node_modules/serverless-python-requirements/lib/inject.js:113:21)
    at Array.forEach (<anonymous>)
    at ServerlessPythonRequirements.injectAllRequirements (.../node_modules/serverless-python-requirements/lib/inject.js:99:8)

Edit: there is an high chance that the error (bug) is more general to 4.0.0 and unrelated to the per-function feature, as it happens to me also after reverting back to one requirement.txt file

@dschep
Copy link
Contributor

dschep commented Apr 17, 2018

There isn't currently anyway to do that afaik. As for the errors. I suspect that's #161

@amitm02
Copy link
Author

amitm02 commented Apr 17, 2018

Thanks, can you please mark as a feature request.
I believe it is a very common scenario for many.

@dschep
Copy link
Contributor

dschep commented Apr 17, 2018

Yup, I consider #161 a bug since this is behavior that should be supported. As you can see on that issue, it's actually the result of an upstream bug in serverless itself. I'm going to close this issue since it's a duplicate and I don't want too much clutter in the issue backlog. Subscribe to #161 and serverless/serverless#4898 to get updates on progress.

@amitm02
Copy link
Author

amitm02 commented Apr 17, 2018

What i meant was a request for a feature that support a general (root directory) requirements.txt file with optional additional requirement.txt files in modules.

@dschep
Copy link
Contributor

dschep commented Apr 17, 2018

Ohhh, right!! Yes, I'll reopen and add the right tag.

@pgrzesik
Copy link
Contributor

Hey 👋 I'm closing this ticket as it looks like it's heavily outdated, we can of course reopen it if needed 👍

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

No branches or pull requests

3 participants