编程语言
首页 > 编程语言> > AWS Lambda Python libssl C库

AWS Lambda Python libssl C库

作者:互联网

尝试在AWS lambda上为Python中的Pusher服务部署包.

当我运行像这样的简单代码

from pusher import Pusher
def pusherTest(context, event):
    mypusher = Pusher(app_id=u'***', key=u'***', secret=u'***')
    mypusher.trigger('testchannel', 'testevent', {u'some': u'data'})

我得到了这个堆栈跟踪.

libssl.so.1.0.0: cannot open shared object file: No such file or directory: ImportError
Traceback (most recent call last):
  File "/var/task/Lambda.py", line 3, in pusherTest
    mypusher = Pusher(app_id=u'***', key=u'***', secret='***')
  File "/var/task/pusher/pusher.py", line 42, in __init__
    from pusher.requests import RequestsBackend
  File "/var/task/pusher/requests.py", line 12, in <module>
    import urllib3.contrib.pyopenssl
  File "/var/task/urllib3/contrib/pyopenssl.py", line 54, in <module>
    import OpenSSL.SSL
  File "/var/task/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/var/task/OpenSSL/rand.py", line 12, in <module>
    from OpenSSL._util import (
  File "/var/task/OpenSSL/_util.py", line 6, in <module>
    from cryptography.hazmat.bindings.openssl.binding import Binding
  File "/var/task/cryptography/hazmat/bindings/openssl/binding.py", line 15, in <module>
    from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: libssl.so.1.0.0: cannot open shared object file: No such file or directory

我相信libssl是一个C库,因为我无法访问Lambda机器来安装这些依赖项,我怎么能让它工作呢?

解决方法:

您是否在Amazon Linux以外的发行版上构建部署包?尝试在Amazon Linux中创建部署包

Python Extension Modules in AWS Lambda

标签:python,amazon-web-services,aws-lambda,libssl
来源: https://codeday.me/bug/20190516/1115740.html