aws-samples / reinvent2019-iot335-code

Code snippets for re:Invent 2019 chalk talk "Implementing multi-region AWS IoT - IOT335"
MIT No Attribution
1 stars 2 forks source link

lambda jitr ssl errors #1

Open neelmitra opened 4 years ago

neelmitra commented 4 years ago

JITR lambda function is failing with the below error -

[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': /var/task/cryptography/hazmat/bindings/_openssl.so: undefined symbol: PyInt_FromLong

After doing some research, it looks like, if you compile on mac with pip, this issue can come. And some recommendations are to package on Amazon linux. So i tried that on cloud9 (linux) , issue still persists. I also tried packaging openssl with pip3, then this issue goes away and other library issue appears such as -

Unable to import module 'lambda_function': /var/task/cryptography/hazmat/bindings/_openssl.so: invalid ELF header [ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named '_cffi_backend' Unable to import module 'lambda_function': No module named enum

psachaamazon commented 4 years ago

The Lambda functions are using Python 3.7. You must make sure your pip3 package installer is for Python 3.7. I tried it successfully on AWS Cloud9 with a custom Python 3.7 version. The AWS Cloud9 I used does not provide Python 3.7 natively. Only Python 3.4 and Python 2.x.

I have also updated 01_Multi_Region_IoT_Shared.ipynb regarding which Python/pip version to use.

Please give it a try an let me know if it works.