examples icon indicating copy to clipboard operation
examples copied to clipboard

Timeout connecting to Confluent Kafka: -185 error

Open jpretorius767 opened this issue 5 years ago • 4 comments

Good day,

I keep getting a timeout when trying to connect to Confluent Kafka using the credentials supplied by Confluent and using the following structure in the https://github.com/confluentinc/examples/tree/master/clients/cloud/nodejs project:

Example from CLI and client configuration:

bootstrap.servers=<SERVER_URL> sasl.username=<CLUSTER_API_KEY> sasl.password=<CLUSTER_API_SECRET>

Please can you have a look at this issue

jpretorius767 avatar Dec 20 '19 06:12 jpretorius767

I have the same issue trying the node example:

➜ node producer.js -f $HOME/.confluent/librdkafka.config -t test-topic
Something went wrong:
Error: Local: Timed out

➜ cat $HOME/.confluent/librdkafka.config
bootstrap.servers=<BROKER>:9092
sasl.username=<API KEY>
sasl.password=<API SECRET>
security.protocol=SASL_SSL
sasl.mechanisms=PLAIN

gdubya avatar May 07 '20 21:05 gdubya

{ Error: Local: Timed out
    at Function.createLibrdkafkaError [as create] (/home/myuser/code/examples/clients/cloud/nodejs/node_modules/node-rdkafka/lib/error.js:261:10)
    at /home/myuser/code/examples/clients/cloud/nodejs/node_modules/node-rdkafka/lib/admin.js:132:28
  message: 'Local: Timed out',
  code: -185,
  errno: -185,
  origin: 'kafka' }

gdubya avatar May 08 '20 05:05 gdubya

I've just come across the same issue, setting the following config item, fixed it for me

api.version.request=false

so it should be:

const producer = new Kafka.Producer({
        'bootstrap.servers': config['bootstrap.servers'],
        'sasl.username': config['sasl.username'],
        'sasl.password': config['sasl.password'],
        'security.protocol': config['security.protocol'],
        'sasl.mechanisms': config['sasl.mechanisms'],
        'api.version.request': false,
        'dr_msg_cb': true
    });

richardhughes avatar May 16 '20 17:05 richardhughes

Thanks - another thing i had to do was:

  1. Install opensssh brew install openssh
  2. put literal api credentials into nodejs.config ie
# Required connection configs for Kafka producer, consumer, and admin
bootstrap.servers=......confluent.cloud:9092
security.protocol=SASL_SSL
sasl.mechanisms=PLAIN
sasl.username=abc123
sasl.password=abc123

# Best practice for higher availability in librdkafka clients prior to 1.7
session.timeout.ms=45000

  1. Ensure the topic requested exists (the example assumes test1 exists...
  2. Edit adminClient in producer.js to include api.version.request as suggested above:
...
  const adminClient = Kafka.AdminClient.create({
    "bootstrap.servers": config["bootstrap.servers"],
    "sasl.username": config["sasl.username"],
    "sasl.password": config["sasl.password"],
    "security.protocol": config["security.protocol"],
    "sasl.mechanisms": config["sasl.mechanisms"],
    "api.version.request": false,
  });
...

aceslick911 avatar Nov 01 '22 20:11 aceslick911