-
Notifications
You must be signed in to change notification settings - Fork 421
Bug: Importing AWSEncryptionSDKProvider in the AWSLambdaPowertoolsPythonV2 layer results in ModuleNotFoundError: No module named '_cffi_backend' #3852
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
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
looking... |
confirmed. @leandrodamascena is gonna send a patch to remove Data Masking from this current layer (regression), and we will look into building a new layer for every Python version due to CFFI. We'll update Data Masking docs in the meantime too. We'll make a patch release today. |
|
making a patch release now where the V2 Layer doesn't have Data masking dependency (Encryption SDK which brings cffi). |
This is now released under 2.34.2 version! |
Expected Behaviour
should run without issue on a py3.11 Lambda function with the latest powertools layer attached.
Current Behaviour
Instead, the above import is raising the exception
ModuleNotFoundError: No module named '_cffi_backend'
.There seems to be an issue with the way
cffi
(a dependency ofcryptography
andaws-sdk-encryption
) was packaged in the powertools layer. From the little research I have done, it looks like powertools uses the same base image to package their layers but cffi is sensitive to the base python version on which it's installed:https://stackoverflow.com/questions/76443834/aws-lambda-python-3-10-no-module-named-cffi-backend
Please note that this is indirectly affecting the
awswrangler
layers:aws/aws-sdk-pandas#2688 (comment)
Code snippet
Possible Solution
Packaging each layer on its dedicated python version might solve this issue
Steps to Reproduce
Run the above code snippet in a Lambda (py311) with the powertools layer:
arn:aws:lambda:eu-west-1:017000801446:layer:AWSLambdaPowertoolsPythonV2:64
Python 3.12 is also impacted. Haven't tested with other runtimes.
This bug was introduced with the addition of
cryptography
as a dependency in the powertools layerPowertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.11
Packaging format used
Lambda Layers
Debugging logs
The text was updated successfully, but these errors were encountered: