脚本在压缩后可在AWS EC2上运行,但不适用于AWS Lambda [英] Script works on AWS EC2, but not on AWS Lambda after zipping
问题描述
我正在使用M2Crypto库创建一个简单的AWS Lambda函数.我按照步骤从这里. lambda函数可在EC2 Linux实例(AMI)上完美运行.
I am creating a simple AWS Lambda function using M2Crypto library. I followed the steps for creating deployment package from here. The lambda function works perfectly on an EC2 Linux instance (AMI).
这是我的功能定义:
from M2Crypto import BIO, RSA, EVP
def verify(event, context):
pem = "-----BEGIN PUBLIC KEY-----\n{0}\n-----END PUBLIC KEY-----".format("hello")
bio = BIO.MemoryBuffer(str.encode(pem))
print(bio)
return
部署程序包结构:
运行Lambda时,出现以下问题,我也尝试从/lib64目录中包含libcrypto.so.10,但没有帮助.
When I run the Lambda, I get the following issue and I also tried including libcrypto.so.10 from /lib64 directory, but didn't help.
/var/task/M2Crypto/_m2crypto.so:符号sk_deep_copy,版本libcrypto.so.10在文件libcrypto.so.10中未定义,具有链接时间参考`
/var/task/M2Crypto/_m2crypto.so: symbol sk_deep_copy, version libcrypto.so.10 not defined in file libcrypto.so.10 with link time reference`
Python: 2.7
M2Crypto: 0.27.0
推荐答案
我猜想M2Crypto是使用与Lambda不同的OpenSSL版本构建的.请参阅相关代码.如果不是这样(上游维护者在这里讲话),请在 https://gitlab.com/上提交错误. m2crypto/m2crypto/issues
I would guess that the M2Crypto was built with different version of OpenSSL than what's on Lambda. See the relevant code. If not (the upstream maintainer speaking here), please, file a bug at https://gitlab.com/m2crypto/m2crypto/issues
这篇关于脚本在压缩后可在AWS EC2上运行,但不适用于AWS Lambda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!