I am trying to use confluent_kafka in my AWS Lambda function and I am adding a layer to it. The layer has a .zip file which contains following packages:
- confluent_kafka
- confluent_kafka_1.8.2.dist-info
- confluent_kafka.libs
Note: All the above folders were created in the venv of pycharm when I ran the following command: pip install confluent_kafka, in the pycharm terminal.
I am getting an error:
{ "errorMessage": "Unable to import module 'lambda_function': No module named 'confluent_kafka.cimpl'", "errorType": "Runtime.ImportModuleError", "requestId": "3531b1f4-36b8-495a-a51f-f0e3105700b8", "stackTrace": [] }
Please help me with solving this error.
You have to zip with only one level of parent. Try to extract the zip file and see if there are multiple folders(nested). for example if "layers" is your folder name then when you extract the zip file you should see the "layers" folder and all other libraries inside it and not another "layers" folder or so.