Skip to content
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

"errorMessage": "Unable to import module 'lambda_function': cannot import name 'exceptions' from 'cryptography.hazmat.bindings._rust' (unknown location)", #10863

Closed
jigarpatell opened this issue Apr 21, 2024 · 9 comments
Labels
Stale waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.

Comments

@jigarpatell
Copy link

jigarpatell commented Apr 21, 2024

i am using one aws lambda function where i need to import ( from cryptography.fernet import Fernet ) cryptography . i have one layer for that lambda function in which cryptography is installed and zipped.

but on running my lambda function it shows error like "errorMessage": "Unable to import module 'lambda_function': cannot import name 'exceptions' from 'cryptography.hazmat.bindings._rust' (unknown location)",

in directory : layer\python\lib\python3.12\site-packages
i used command : pip install cryptography -t .

@alex
Copy link
Member

alex commented Apr 21, 2024

Are you running the pip install command on a system with the same ABI as lambda?

@alex alex added the waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply. label Apr 21, 2024
@jigarpatell
Copy link
Author

I am creating a lambda layer of Cryptography library on my local machine and then uploading that .zip file on the layer for that lambda_function.

my lambda function works perfectly in my local machine, but not in AWS lambda .

in our lambda function we are importing below libraries
"
import csv
import mysql.connector
from cryptography.fernet import Fernet
import os
"

@alex
Copy link
Member

alex commented Apr 21, 2024 via email

@jigarpatell
Copy link
Author

can I create this layer on freshly created EC2 instance or is there any other option available?

@alex
Copy link
Member

alex commented Apr 21, 2024 via email

@jigarpatell
Copy link
Author

thank you for your answer. my error got solved now but a new error came out . when my lambda function got triggered. i got below error log from cloudwatch.

File "/opt/python/lib/python3.12/site-packages/cryptography/exceptions.py", line 9, in
from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
pyo3_runtime.PanicException: Python API call failed
INIT_REPORT Init Duration: 1522.69 ms Phase: invoke Status: error Error Type: Runtime.ExitError

Copy link

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

@github-actions github-actions bot added Stale and removed Stale labels Apr 25, 2024
Copy link

This issue has been waiting for a reporter response for 3 days. It will be auto-closed if no activity occurs in the next 5 days.

@github-actions github-actions bot added the Stale label Apr 30, 2024
Copy link

github-actions bot commented May 6, 2024

This issue has not received a reporter response and has been auto-closed. If the issue is still relevant please leave a comment and we can reopen it.

@github-actions github-actions bot closed this as completed May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale waiting-on-reporter Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.
Development

No branches or pull requests

3 participants
@alex @jigarpatell and others