confluent-kafka-python icon indicating copy to clipboard operation
confluent-kafka-python copied to clipboard

AttributeError: module 'os' has no attribute 'add_dll_directory' - Python 3.9 - Lambda Function in AWS

Open ANJALI2980 opened this issue 2 years ago • 9 comments

Description

I have created a layer with confluent_kafka-2.0.2 in lambda function. when I simply run it, I get error at import statement.

confluentkafka

Code : codesnippet

Attached Zip file used for creating layer : confluentkafka.zip

How to reproduce

Checklist

Please provide the following information:

  • [ ] confluent-kafka-python and librdkafka version (confluent_kafka 2.0.2) and confluent_kafka.libversion()):
  • [ ] Apache Kafka broker version:
  • [ ] Client configuration: {...}
  • [ ] Operating system: windows
  • [ ] Provide client logs (with 'debug': '..' as necessary)
  • [ ] Provide broker log excerpts
  • [x] Critical issue

ANJALI2980 avatar Feb 28 '23 14:02 ANJALI2980

The issue seems similar to https://github.com/confluentinc/confluent-kafka-python/issues/1462. Please check.

pranavrth avatar Mar 03 '23 05:03 pranavrth

#1462 was resolved by switching to Linux. I need to get it resolved in windows

ANJALI2980 avatar Mar 03 '23 07:03 ANJALI2980

#1462 was resolved by switching to Linux. I need to get it resolved in windows

can you describe the fix in more details?

shot87 avatar Jun 22 '23 10:06 shot87

#1462 got resolved when the operating system was switched to Linux.

ANJALI2980 avatar Jun 23 '23 16:06 ANJALI2980

were you able to fix this issue

arryan231 avatar Nov 20 '23 10:11 arryan231

Experienced the same issue; using windows os environment in development, AWS Lambda (AWS Linux) python 3.11 runtime in production.

The error is resolved by creating package within linux/unix environment using virualization. add_dll_directory applies to windows os. runtime and is not compatible when running on linux. For more read #1462

the-real-henry avatar Nov 26 '23 20:11 the-real-henry

@ANJALI2980 is this issue still needing to be resolved or were you able to find a solution?

nhaq-confluent avatar Feb 13 '24 02:02 nhaq-confluent

Does anyone in this thread have a compatible lambda-function layer for AWS Lambda with any version between python3.9-3.11?. There are lots of questions with outdated answers on this.

phanicode avatar Aug 20 '24 00:08 phanicode