无服务器部署 - aws lambda; confluent-kafka错误

时间:2018-03-08 15:15:05

标签: python amazon-web-services aws-lambda confluent-kafka serverless

我正在尝试在aws lambda中导入confluent_kafka并得到下面提到的错误,(confluent-kafka == 0.11.4rc1,librdkafka 0.11.3)

Command "/var/lang/bin/python3.6 -u -c "import setuptools, 
tokenize;__file__='/tmp/pip-build-ntio3ka8/confluent-
kafka/setup.py';f=getattr(tokenize, 'open', open)
(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" --no-user-cfg 
install --record /tmp/pip-crmp967f-record/install-record.txt --
single-version-externally-managed --compile --home=/tmp/tmp_57pgtu7" 
failed with error code 1 in /tmp/pip-build-ntio3ka8/confluent-kafka/

能够在本地环境和虚拟python环境中导入。但是当我在aws lambda中调用一个函数的时候,上面提到了错误。

Serverless.yml

service: test-one-confluent-kafka
provider:
   name: aws
   runtime: python3.6


functions:
   hello:
     handler: handler.hello

plugins:
  - serverless-python-requirements

custom:
  pythonRequirements:
     dockerizePip: non-linux

handler.py

import json
from confluent_kafka import Producer

def hello(event, context):
   print("Test Confluent Kafka")

if __name__ == "__main__":
   hello("","")

0 个答案:

没有答案