You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using per-function requirements according to the explanation on the web page.
I'm encountering this strange problem in which packaging generates TWO zip files per function. One of the two zips contains the included files from the local source code. The other one contains the handler.py and the pip requirements.
package:
individually: true
exclude:
- '**'
functions:
ShortFunctionName1: # the shorthand name we use to refer to the function within serverless.yml
name: fully-qualified-function-name-1 # the fully qualified function name used in AWS Lambda
module: lambda_1
package:
include:
- 'shared/**'
- 'lambda_1/**'
handler: handler.handle_lambda_event
ShortFunctionName2:
name: fully-qualified-function-name-2
module: lambda_2
package:
include:
- 'shared/**'
- 'lambda_2/**'
handler: handler.handle_lambda_event
What happens during packaging is the following:
packaging generates 2 zip files per function:
ShortFunctionName1.zip --> contains the files matching the include patterns lambda_1/ and shared/ with files underneath)
lambda_1-fully-qualified-function-name-1.zip --> contains handler.py from directory lambda_1/ on the root. also contains all pip requirements)
the same applies to function_2, we get one zip with the short name and one with the fully qualified name.
deployment uploads only the zip files with file fully qualified name to AWS.
runtime you get an ImportError: modules under lambda_1 or shared are obviously not found because these directories weren't packaged in this zip file.
I believe this is a bug in the packaging process, where there is inconsistent usage of the shorthand and fully qualified function names in establishing the target zip filename.
Hey @freekwiekmeijer, thanks a lot for reporting and sorry that you've run into trouble here. Just so I understand it correctly, the issue happens when you're specifying name explicitly for each of the functions and you use individual packaging, right?
Problem:
Using per-function requirements according to the explanation on the web page.
I'm encountering this strange problem in which packaging generates TWO zip files per function. One of the two zips contains the included files from the local source code. The other one contains the handler.py and the pip requirements.
Delatils:
Project structure:
Snippet from serverless.yml
What happens during packaging is the following:
lambda_1/
andshared/
with files underneath)handler.py
from directorylambda_1/
on the root. also contains all pip requirements)ImportError
: modules underlambda_1
orshared
are obviously not found because these directories weren't packaged in this zip file.I believe this is a bug in the packaging process, where there is inconsistent usage of the shorthand and fully qualified function names in establishing the target zip filename.
Software versions:
Serverless framework: 3.19.0
Serverless-python-requirements: 5.4.0
The text was updated successfully, but these errors were encountered: