Error when using the layer with the PyCryptodome lib

0

I created a Lambda Layer to use the pycryptodome lib, however when calling the function it is returning an error, could you help me how can I correct this error to make the call?

Error Evidence: error_lib_pycrypto

"errorMessage": "Cannot load native module 'Crypto.Cipher._raw_ecb': Not found '_raw_ecb.cpython-311-x86_64-linux-gnu.so', Not found '_raw_ecb.abi3.so', Not found '_raw_ecb.so'", "errorType": "OSError",

bguerra
asked 6 months ago384 views
3 Answers
1

Hi,

I would just you to have a look at https://github.com/Legrandin/pycryptodome/issues/69 to find a workaround to your issue. This issue is still open.

Best,

Didier

profile pictureAWS
EXPERT
answered 6 months ago
  • I'll look and try to follow the explanation.

    Thanks.

1

Hello.

It may not work properly due to dependencies of the OS on which the layer was created.
https://docs.aws.amazon.com/lambda/latest/dg/packaging-layers.html

The first step to creating a layer is to bundle all of your layer content into a .zip file archive. Because Lambda functions run on Amazon Linux, your layer content must be able to compile and build in a Linux environment. If you build packages on your local Windows or Mac machine, you’ll get output binaries for that operating system by default. These binaries may not work properly when you upload them to Lambda.

Most runtimes use Amazon Linux2, so try creating a layer on Amazon Linux2 and see if it works.
https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html

profile picture
EXPERT
answered 6 months ago
profile pictureAWS
EXPERT
reviewed 6 months ago
0

Hello,

I followed the documentation below and it worked.

https://repost.aws/pt/knowledge-center/lambda-python-package-compatible

Thanks to all for your help.

BG

bguerra
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions