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

Issue while building python code in lambda #42

Open
shivgit87 opened this issue Sep 6, 2018 · 2 comments
Open

Issue while building python code in lambda #42

shivgit87 opened this issue Sep 6, 2018 · 2 comments

Comments

@shivgit87
Copy link

I have built JKS package and trying to execute the code in Lambda by uploading as a zip. While trying to test the code I am getting following error 👎

START RequestId: d210481c-b1d6-11e8-96b2-dbaf32b85648 Version: $LATEST
module initialization error: Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cpython-36m-x86_64-linux-gnu.so': /var/task/Crypto/Util/../Hash/_MD5.cpython-36m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory, Trying '_MD5.abi3.so': /var/task/Crypto/Util/../Hash/_MD5.abi3.so: cannot open shared object file: No such file or directory, Trying '_MD5.so': /var/task/Crypto/Util/../Hash/_MD5.so: cannot open shared object file: No such file or directory

END RequestId: d210481c-b1d6-11e8-96b2-dbaf32b85648
REPORT RequestId: d210481c-b1d6-11e8-96b2-dbaf32b85648 Duration: 516.12 ms Billed Duration: 600 ms Memory Size: 128 MB Max Memory Used: 29 MB
module initialization error
Cannot load native module 'Crypto.Hash._MD5': Trying '_MD5.cpython-36m-x86_64-linux-gnu.so': /var/task/Crypto/Util/../Hash/_MD5.cpython-36m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory, Trying '_MD5.abi3.so': /var/task/Crypto/Util/../Hash/_MD5.abi3.so: cannot open shared object file: No such file or directory, Trying '_MD5.so': /var/task/Crypto/Util/../Hash/_MD5.so: cannot open shared object file: No such file or directory

It says Cannot load native module.

@mahmoud
Copy link
Collaborator

mahmoud commented Sep 6, 2018

Hmm, seems like a packaging issue that's affecting the Crypto package (we use pycryptodome). Are other binary dependencies working?

I'm not familiar with Lambda's packaging requirements, but you may want to post in the appropriate support forums or on StackOverflow.

@MikeArchbold
Copy link

MikeArchbold commented Aug 6, 2021

Came across this same issue. You need to install the runtime on linux system as cryptodome is os specific and lambda runs with linux backend
source - Legrandin/pycryptodome#69

Steps I followed
- spun up ec2 instance with amzn linux 2
- installed python3.8 -> https://techviewleo.com/how-to-install-python-on-amazon-linux/
- created own requirement file w/ updated pycryptodomex
pyasn1==0.3.5 pyasn1_modules==0.0.8 javaobj-py3==0.2.1 pycryptodomex==3.10.1
- ran requirements file
python3.8 -m pip install -r ./requirements.txt -t renew_certificate/ --no-dependencies
- zipped file, scp'd to my machine, uploaded to lambda
- need to create a lambda layer as the function is now too big to get the gui view
- need to change file structure so files are in python folder
python3.8 -m pip install -r requirements2.txt -t python --no-dependencies
- zip -r renew_certificate.zip python
- upload to lambda layer and set lambda layer in my lambda function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants