Skip to content

some questions about per-function requirements modules #207

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 Jun 19, 2018 · 7 comments
Closed

some questions about per-function requirements modules #207

amitm02 opened this issue Jun 19, 2018 · 7 comments
Labels

Comments

@amitm02
Copy link

amitm02 commented Jun 19, 2018

  1. if functions in the different module needs a shared py file, how can they import it?
  2. do files stated in the serverless.yml
package:
 - include

are added to the lambdas?

@dschep
Copy link
Contributor

dschep commented Jun 19, 2018

correct.

@cgrimal
Copy link

cgrimal commented Jun 29, 2018

Hi guys, have you successfully used it?
I have the same use case, and I can't make it work. The include/exclude directives are totally ignored, whether they are at the package top level, or at function level.

Please note I am using individually packaging.

@infinitedreams9586
Copy link

Hi guys, have you successfully used it?
I have the same use case, and I can't make it work. The include/exclude directives are totally ignored, whether they are at the package top level, or at function level.

Please note I am using individually packaging.

I have same issue. I mentioned the folder name in include but it is ignored.

@koushinrin
Copy link

Including files outside the module doesn't work.
It correctly packaged locally, but didn't deploy all the packaged files to the remote lambda.

@dschep
Copy link
Contributor

dschep commented Oct 31, 2018

if you have shared code outside the modules, symlink that into the modules.

@bweigel
Copy link
Contributor

bweigel commented Nov 14, 2018

It seems like the package includes and excludes won't have an impact on packaging if invoked with individually: true. This is due to the two part process underlying the implementation:

  1. the basic serverless packaging creates a zip-File called <functionname>.zip, which basically contains (on a function level) everything according to the defined excludes and includes.
  2. a part of the zip-File resulting from step 1 is injected into a final zip (which also contains the requirements)

What do I mean, by a part? Only files contained under the directory specified by module are copied to the final zip.

see inject.js:

function moveModuleUp(source, target, module, options) {
    ...
    .then(sourceZip => sourceZip.filter(file => file.startsWith(module + '/')))
    ...

This is intended behavior right now. However, I am currently also working on the individually feature and think this could be part of the new functionality which I am proposing in #279 .

@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
Labels
Projects
None yet
Development

No branches or pull requests

8 participants