serverless deploy - aws lambda; confluent-kafka er

2019-08-17 17:15发布

am trying to import confluent_kafka in aws lambda and getting below mentioned error, (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/

Am able to import in a local environment and virtual python environment. But when i invoke a function in aws lambda that time got above-mentioned error.

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条回答
登录 后发表回答