For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • SDKs
    • SDK concepts
    • SDK features
    • Client-side SDKs
    • Server-side SDKs
      • .NET SDK reference
      • Apex SDK reference
      • C++ SDK reference
      • Erlang SDK reference
      • Go SDK reference
      • Haskell SDK reference
      • Java SDK reference
      • Lua SDK reference
      • Node.js SDK reference
        • Node.js (server-side) SDK 8.x to 9.0 migration guide
        • Node.js (server-side) SDK 7.x to 8.0 migration guide
        • Node.js (server-side) SDK 6.x to 7.0 migration guide
        • Node.js (server-side) SDK 5.x to 6.0 migration guide
      • PHP SDK reference
      • Python SDK reference
      • Ruby SDK reference
      • Rust SDK reference
    • AI SDKs
    • Edge SDKs
    • OpenFeature providers
    • Observability SDKs
    • Relay Proxy
Sign inTry it free
LogoLogo
On this page
  • Overview
  • Identifying Node.js versions for the 6.0 SDK
  • Understanding changes to dependencies
  • Understanding changes to the Redis integration
  • Understanding changes to logging
  • Understanding changes to the file data source
  • Understanding what was deprecated
SDKsServer-side SDKsNode.js SDK reference

Node.js (server-side) SDK 5.x to 6.0 migration guide

Was this page helpful?
Previous

PHP SDK reference

Next
Built with

Overview

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.

Identifying Node.js versions for the 6.0 SDK

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.

Understanding changes to dependencies

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 winston package by default. You can still use winston. To learn more, read Understanding changes to logging.
  • yaml: The SDK no longer uses the yaml package by default. This only affects FileDataSource. To learn more, read Understanding changes to the file data source.

Understanding changes to the Redis integration

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: launchdarkly-node-server-sdk-redis.

Add this dependency to your project by editing package.json, or with this command:

Installing with npm
$npm install launchdarkly-node-server-sdk-redis

Then, in any JavaScript files where you were previously referring to RedisFeatureStore, change the reference as shown here:

1const LaunchDarkly = require('launchdarkly-node-server-sdk');
2
3const store = LaunchDarkly.RedisFeatureStore();

Understanding changes to logging

Previously, if you did not specify your own logger in the logger property, the SDK used winston to create a logger.

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 basicLogger.

Understanding changes to the file data source

The 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 FileDataSource.

Understanding what was deprecated

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.