node-server-sdk
node-server-sdk copied to clipboard
Method `LaunchDarkly.init` blows up when the user provides an invalid key
trafficstars
Describe the bug
The method LaunchDarkly.init blows up when the user provides an invalid key.
To reproduce
Call LaunchDarkly.init with an invalid key.
Expected behavior As a FF SDK I would expect the SDK to never blow up. Instead the init method should return a client with a failure state, that can be check unattended. Example below:
const client = LaunchDarkly.init()
client.initialized() => false
client.getStatus() => { initialized: false, initError: 'invalid SDK key', connectionEstablished: true }
I can provide a contribution, if we have an agreement here.
Logs
error: [LaunchDarkly] Authentication failed. Double check your SDK key.
error: [LaunchDarkly] Received error 401 (invalid SDK key) for streaming request - giving up permanently
SDK version
"launchdarkly-node-server-sdk": "^7.0.3",
Language version, developer tools
- node 18
OS/platform
- macOS