All notable changes to the LaunchDarkly Node.js SDK will be documented in this file. This project adheres to Semantic Versioning.
- The promise from
waitForInitialization()
, if successful, now resolves with a value: the client. Previously, it resolved with no value. (Thanks, rmanalan!)
- Receiving an HTTP 400 error from LaunchDarkly should not make the client give up on sending any more requests to LaunchDarkly (unlike a 401 or 403).
- Now outputs a more descriptive log message if
allFlags
is called with a null user object. (Thanks, jbatchelor-atlassian!) - Added TypeScript definitions for some previously undefined types.
- Updated
request
package dependency to2.87.0
, to avoid a security vulnerability in a package used byrequest
.
- The new event
"failed"
will fire if client initialization failed due to any of the unrecoverable errors described below. If you prefer to use Promises, there is a new methodwaitForInitialization()
, which behaves exactly likewaitUntilReady()
except that its Promise will be rejected if the "failed" event fires. (For backward compatibility, the Promise returned bywaitUntilReady()
will never be rejected.) (#96)
- The client now treats most HTTP 4xx errors as unrecoverable: that is, after receiving such an error, it will not make any more HTTP requests for the lifetime of the client instance, in effect taking the client offline. This is because such errors indicate either a configuration problem (invalid SDK key) or a bug, which is not likely to resolve without a restart or an upgrade. This does not apply if the error is 400, 408, 429, or any 5xx error.
- Fixed a bug that would cause a null reference error if you called
close()
on an offline client. (Thanks, dylanlingelbach!)
- The
waitUntilReady()
method is now deprecated in favor ofwaitForInitialization()
(see above).
- Removed an indirect dependency on an old version of the
querystringify
module, which had a security flaw. (#97) - Updated TypeScript definitions for client options. (Thanks, stepanataccolade!)
- Fixed a bug that caused summary events to combine two different counters: a) flag evaluations that produced the flag's first variation, and b) counts for flag evaluations that fell through to the default value.
- Removed debug-level logging that was listing every analytics event.
- To reduce the network bandwidth used for analytics events, feature request events are now sent as counters rather than individual events, and user details are now sent only at intervals rather than in each event. These behaviors can be modified through the LaunchDarkly UI and with the new configuration option
inlineUsersInEvents
. For more details, see Analytics Data Stream Reference. - Pending analytics events are now flushed if 1. the configured
flush_interval
elapses or 2. you explicitly callflush()
. Previously, if the number of events exceeded the configured capacity it would also trigger a flush; now, the client will simply drop events until the next timed or explicit flush occurs. This makes the Node SDK consistent with the other SDKs, and prevents unbounded use of network resources if you are generating analytics events rapidly. - When sending analytics events, if there is a connection error or an HTTP 5xx response, the client will try to send the events again one more time after a one-second delay.
- In every function that takes an optional callback parameter, if you provide a callback, the function will not return a promise; a promise will be returned only if you omit the callback. Previously, it would always return a promise which would be resolved/rejected at the same time that the callback (if any) was called; this caused problems if you had not registered an error handler for the promise.
- Removed a dependency on
hoek
v4.2.0, which had a security flaw; now uses 4.2.1 instead.
- All function and property names that used underscores are now deprecated; please use their camelCase equivalent instead (e.g.
allFlags
instead ofall_flags
). The deprecated names will still work for now, but will trigger a warning message in the log.
- The waitUntilReady Promise will now resolve even after the ready event was emitted — thanks @dylanjha
- Fixed a bug that could cause a call stack overflow when calling
all_flags
with a very large number of flags, or evaluating a flag with a very large number of rules. This should no longer happen no matter how many flags or rules there are.
- Fixed a bug that would cause an unhandled promise rejection warning-- and, depending on your Node configuration, a crash-- if there was an HTTP error during an automatic event flush.
- In the Redis feature store, fixed synchronization problems that could cause a feature flag update to be missed if several of them happened in rapid succession.
- Any Redis connection failure will now be logged and will trigger reconnection attempts transparently. Previously, it caused an uncaught exception. Note that during a Redis outage, flag evaluations will use the last known value from the in-memory cache if available (if this cache was enabled with the
cache_ttl
parameter toRedisFeatureStore
), or otherwise the default value. - Fixed a bug in the Redis adapter that caused an error ("Transaction discarded because of previous errors") at startup time if there were either no feature flags or no user segments.
- Fixed a bug that caused a spurious Redis query for the key "launchdarkly:undefined".
- Fixed a bug that could cause analytics events not to be reported for feature flags that were evaluated due to being prerequisites of other flags.
- Support for a new LaunchDarkly feature: reusable user segments.
- The feature store interface has been changed to support user segment data as well as feature flags. Existing code that uses
RedisFeatureStore
should work as before, but custom feature store implementations will need to be updated.
- Adds support for a future LaunchDarkly feature, coming soon: semantic version user attributes.
- When using a Redis feature store, if the client has not finished initializing but the store has already been populated, checking a feature flag will use the last known data from the store rather than returning the default value.
- For consistency with the other SDKs, it is no longer possible to compute rollouts based on a user attribute whose value is a floating-point number or a boolean. String and int attributes are allowed.
- The TypeScript definition for the
all
method ofLDFeatureStore
is now correct — #77
- Methods that expose a
Promise
interface now properly return the resolution or rejection value to the caller. #75
- Support for private user attributes.
- Only emit stream 401 errors once
- New
send_events
option to control whether the SDK should send events back to LaunchDarkly or not. Defaults totrue
.
- If the SDK gets a 401 from LaunchDarkly it will stop retrying to connect since there is no way for the SDK key to become valid again.
- Asynchronous SDK methods now return a
Promise
; the SDK now supports both the Node.js error callback interface and thePromise
interface. (#58) - The SDK now emits an
error
event. If noerror
event handler exists, errors will be logged using the configured logger. (#55) - The SDK now returns context-specific error objects to make it easier to handle errors from consumer code. (#56)
- A new
update
event is available on the client to be notified whenever the SDK receives feature flag updates from LaunchDarkly.
- More consistent User-Agent header usage
- Release script
- Fixed implicit any in typescript definition
- Improved error logging when polling
- Update typescript definitions
- Improve compatibility with ts-node parser
- Fix incorrect typescript definition for init()
- Add typescript definitions
- Log shorter messages, with a stack trace, for known errors with messages
- Fixed a bug where all_flags would not display correct flag result for user
- Fixed a bug in initialization that caused high CPU usage
- Bug fix for receiving updates to large feature flags
- Numerous bug fixes for the Redis feature store
- The event queue is no longer a global property, so multiple clients initialized in one node process now send events to the correct environment
- The
RedisFeatureStore
now takes an optional prefix parameter
- Mark the client initialized immediately in LDD mode
- Fixed a bug in the secure_mode_hash function
- The
ready
event now gets properly emitted in offline mode.
- Support for multivariate feature flags. In addition to booleans, feature flags can now return numbers, strings, dictionaries, or arrays via the
variation
method. - New
all_flags
method returns all flag values for a specified user. - New
secure_mode_hash
function computes a hash suitable for the new LaunchDarkly JavaScript client's secure mode feature. - New
initialized
function returns whether or not the client has finished initialization.
- The
toggle
call has been deprecated in favor ofvariation
.