Node.js (server-side) SDK 5.x to 6.0 migration guide
Read time: 3 minutes
Last edited: Feb 09, 2023
This topic explains how to adapt code that currently uses a 5.x version of the Node.js server-side SDK to use version 6.0 or later.
Before you migrate to 6.0, update to the latest 5.x version. To learn more about updating to the latest 5.x version, visit the SDK's GitHub repository.
The 6.0 version of the SDK is compatible with Node.js versions 12 and higher. LaunchDarkly no longer supports older Node.js versions, as is documented in the End of Life policy.
LaunchDarkly also no longer supports some Node.js versions above 12 that are not long-term-support versions and have reached their end of life. To learn more, read the Node.js releases page.
To reduce the size of the SDK code, some dependencies have been removed or made optional.
redis: The Redis integration is no longer included in the SDK package. It is now a separate package. To learn more, read Understanding changes to the Redis integration.
winston: The SDK no longer uses the
winstonpackage by default. You can still use
winston. To learn more, read Understanding changes to logging.
yaml: The SDK no longer uses the
yamlpackage by default. This only affects
FileDataSource. To learn more, read Understanding changes to the file data source.
If you use the Redis integration, it has a different location for the 6.0 version of the SDK.
Instead of being bundled in the main SDK package, it is now in its own package:
Add this dependency to your project by editing
package.json, or with this command:
npm install launchdarkly-node-server-sdk-redis
RedisFeatureStore, change the reference as shown here:
const LaunchDarkly = require('launchdarkly-node-server-sdk');const store = LaunchDarkly.RedisFeatureStore();
In versions 6.0 and higher of the SDK, if you do not specify your own logger, the SDK writes log output directly to the console. It uses the same format that it was previously using with
winston, so you may not notice any difference.
If you want to use
winston, you can still create a
winston logger and put it in the SDK's
logger property. This works exactly the same as before. The only difference is that you must make sure
winston exists as a dependency in your project, instead of the dependency being provided automatically by the SDK.
The SDK also has a new option to allow configuring a simple logger without using
winston. To learn more, read
FileDataSource component allows you to load feature flag data from files. The file data can be either JSON or YAML.
In versions 6.0 and higher of the SDK, the
yaml package is no longer loaded by default. Without it,
FileDataSource will only allow JSON files.
If you want to use YAML data files, add the
yaml package as a dependency in your project. The SDK automatically detects that
yaml is present, and enables YAML parsing in
All types and methods that were marked as deprecated/obsolete in the last 5.x release have been removed from the 6.0 release. If you were using these with a recent version previously, you should already have received deprecation warnings at build time or runtime, with suggestions about their recommended replacements.