1

I am trying to follow these instructions for connecting locally to my heroku kafka using kafkacat: https://gist.github.com/crcastle/cb21c2148fc57ad89753bf28b561d910

I am creating an env file like this:

heroku config -s > .env

and then running this script to try to listen

#! /usr/bin/env bash

set -e

source .env

kafkacat -C -t ${KAFKA_PREFIX}test-topic -b $KAFKA_URL \
-X security.protocol=ssl \
-X ssl.key.location=<(echo $KAFKA_CLIENT_CERT_KEY) \
-X ssl.ca.location=<(echo $KAFKA_TRUSTED_CERT) \
-X ssl.certificate.location=<(echo $KAFKA_CLIENT_CERT)

Then I get this error:

% ERROR: Failed to create producer: ssl.ca.location failed: No error

Funny thing is it says producer even though I am trying to consume.

I can produce and consume from the same topic using

heroku kafka:topics:write test-topic "test 1"

and

heroku kafka:topics:tail test-topic
Alex028502
  • 3,486
  • 2
  • 23
  • 50

1 Answers1

0

On OSX, I don't think the <(...) syntax is supported. Try:

heroku config:get KAFKA_TRUSTED_CERT -a my-app > $PWD/ca.pem
heroku config:get KAFKA_CLIENT_CERT -a my-app > $PWD/cert.pem
heroku config:get KAFKA_CLIENT_CERT_KEY -a my-app > $PWD/cert.key
export KAFKA_URL="$(heroku config:get KAFKA_URL -a my-app | sed 's/kafka\+ssl\:\/\///g')"
export TOPIC="my-topic"

kafkacat -C -t $TOPIC -b $KAFKA_URL \
-X security.protocol=ssl \
-X ssl.key.location=$PWD/cert.key \
-X ssl.ca.location=$PWD/ca.pem \
-X ssl.certificate.location=$PWD/cert.pem
Brian Low
  • 11,605
  • 4
  • 58
  • 63
  • Thanks. That's not the problem here. I was using ubuntu. Unfortunately I can't check because I turned off the paid service and switched to another hosted kafka. – Alex028502 May 30 '18 at 07:12
  • It does seem to work on mac though. Try this `cat <(echo test1) <(echo test2)` or even `echo <(echo test1) <(echo test2)` - funny both osx and linux start with `/dev/fd/63` and count down – Alex028502 May 30 '18 at 08:03