Serverless-python-requirements: some questions about per-function requirements modules

Created on 19 Jun 2018  路  6Comments  路  Source: UnitedIncome/serverless-python-requirements

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?

question

Most helpful comment

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.

All 6 comments

correct.

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.

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.

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

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

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 .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nknotts picture nknotts  路  5Comments

xedef picture xedef  路  3Comments

gutyril picture gutyril  路  5Comments

amadensor picture amadensor  路  3Comments

calclavia picture calclavia  路  5Comments