-
Notifications
You must be signed in to change notification settings - Fork 290
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
Support per-function requierments with shared code #767
Comments
So having had a look at the code, extending this behavior should be quite trivial. The existing code already copies files from the function.zip, but it filters based on the module, and moves the module to the root.
The moveModuleUp function could take in a new parameter, and if true it would return Object.values(sourceZip.files) instead of filtering. |
+1 |
2 similar comments
+1 |
+1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
Use case description
See: #734
Besides it being a bug report, it describes the use case, also see:
#168
#435
Currently I find the behavior of per function requirements odd, because to me it seems it;s basically a more performant? implementation of https://www.serverless.com/framework/docs/guides/compose
As it uses the module as the entry point and thus you can not use shared code.
Project structure:
serverless.yml:
So currently packaging this results in the following artifacts:
The RESTAPI zip file contains:
so the files and folderz defined in package patterns.
and the web-service-stage-RESTAPI zip file contains the web requirements and the contents of the web folder in our project.
When deploying the zips with the fully qualified name get deployed. Thus you can not share code, because as it is specified in the documentation, the module folder becomes the root of the zip of the function.
Currently there is a workaround that people are using the vendor option if only one folder is shared, but this approach does not work for multiple folders
Proposed solution (optional)
So a general idea would be to combine the zip named as the fully qualified function name and the zip named as the function excluding the folder named as the module. But here there could be an issue if there would be no patterns supplied in the root package field.
So I would propose that the merging/copying would only happen if there are patterns defined in the root package field and also including an extra field in custom pythonRequirements or maybe inside the function definitions, something along the lines of includeNonModuleFiles to ensure no breaking changes.
I'm wondering if this is possible or if there are any issues with this approach? Have not looked at the code yet, so no idea if my approach would be feasible. Also is this a use case that this plugin would even want to support?
The text was updated successfully, but these errors were encountered: