launchdarkly / node-server-sdk

LaunchDarkly Server-side SDK for Node
Other
79 stars 65 forks source link

V2: Error event not triggering #34

Closed tenx-btoney closed 8 years ago

tenx-btoney commented 8 years ago

The error event doesn't seem to be emitted if there is a bad api key, or if any of the api calls fail

const API_KEY = '123'

var LaunchDarkly = require('ldclient-node')
var ldClient = LaunchDarkly.init(API_KEY)

// Or with good key
// var ldClient = LaunchDarkly.init(API_KEY, { stream_uri: "http://localhost:8675", events_uri: "http://localhost:8675" })

ldClient.once('ready', function () {
  console.log('hooray')
})

ldClient.once('error', function (err) {
  console.log(err)
})
adriantoine commented 8 years ago

I had the same issue, following the tutorial I am using

ldClient.once('ready', function () {
  ...
});

but the callback is never executed. That's a bit annoying that the tutorial doesn't work, can you either change the tutorial or fix events?

apucacao commented 8 years ago

Sorry for the delay on this. We'll have a fix out shortly.

Thank you for your patience.

apucacao commented 8 years ago

This was fixed as of version 2.0.1. We just released version 2.0.2 which will not emit an error, but will instead log any connection errors.