Azure/azure-event-hubs-node

cannot connect to eventhub

Closed this issue · 4 comments

lipp commented

Hi!

I'd like to connect to one of my eventhubs like this:

const EventHubClient = require('azure-event-hubs').Client

// copied from azure portal
const connectionString = 'Endpoint=sb://XXX.servicebus.windows.net/;SharedAccessKeyName=XXX;SharedAccessKey=XXX=;EntityPath=test'

const client = EventHubClient.fromConnectionString(connectionString)

client.open()
  .then(() => {
    console.log('connected')
  })
  .catch(err => {
    console.error('failed', err)
  })

However, nothing happens (nothing gets printed on console) and process waits forever.
Am I missing something?

This looks correct. Maybe try and remove the EntityPath section of the connection string and add its value (test) as a second argument of the EventHubClient.fromConnectionString() call? that's another way of instantiating the client. Not convinced it could make a difference, unless we have a bug...

The other thing I could think of would be: either a mismatch between your hub configuration and your connection string (did you build it yourself or did you copy/paste it from the portal?) or maybe a firewall issue (requires port 5671 to be open since it's using the AMQP protocol over TLS)

lipp commented

Got it 😱My messy company network blocked the port.

Everything is working fine! Sorry for wasting your time!

Thanks for reporting. no problem!!

[0x1dee368]:ERROR[-2] AMQP header mismatch: 'AMQP\x02\x01\x00\x00
i am getting this error while run the sender