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
See attached images below. I'm trying to make use of a common sibling directory, "group" for my 3 different lambda functions: post, get, get_detail. I'm just testing post now just trying to get simple example of importing of sibling directory references in Python. Looking at build of post by Gordon, it appears its not sucking in the relative references that would be needed to be part of build to make this code work in AWS Lambda. Error I get by AWS is "module initialization error: Attempted relative import in non-package". You can see in the screenshot that I unzipped the group_post.zip file and its missing the relative reference as it seems that Gordon only builds out one directory that encapsulates the code.py lambda file.
The text was updated successfully, but these errors were encountered:
Note, I did play with this and tried to create sample that makes use of common code but either Gordon doesn't yet support this or I'm attacking it wrong. My experience with common code across lambda functions within an app (microservice) is from Serverless. See https://serverlesscode.com/post/python-on-serverless-intro/ and look for section titled "Writing Common Code". I'm trying to achieve common lib code for an app (in my case model code for Pynamodb that would be re-usable across multiple lambda functions).
This would be useful as well as the ability to provide the pip dependencies in a zip file that can be merged into the deployment package. E.g. anything using PyOpenSSL needs to be compiled against openssl on an Amazon Linux AMI. Python modules with native C extensions compiled on OSX, err macOS, don't work when packaged up and deployed to lambda. By don't work I mean when executing the lambda function Python is unable to load the module containing the handler.
See attached images below. I'm trying to make use of a common sibling directory, "group" for my 3 different lambda functions: post, get, get_detail. I'm just testing post now just trying to get simple example of importing of sibling directory references in Python. Looking at build of post by Gordon, it appears its not sucking in the relative references that would be needed to be part of build to make this code work in AWS Lambda. Error I get by AWS is "module initialization error: Attempted relative import in non-package". You can see in the screenshot that I unzipped the group_post.zip file and its missing the relative reference as it seems that Gordon only builds out one directory that encapsulates the code.py lambda file.
The text was updated successfully, but these errors were encountered: