
Product
Go Support Is Now Generally Available
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
@launchdarkly/cloudflare-server-sdk
Advanced tools
The LaunchDarkly Cloudflare SDK is designed primarily for use in multi-user Cloudflare workers. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.
This SDK is a replacement of launchdarkly-cloudflare-edge-sdk. Please consider updating your application to use this package instead.
For more information, see the complete reference guide for this SDK.
# npm
npm i @launchdarkly/cloudflare-server-sdk
# yarn
yarn add @launchdarkly/cloudflare-server-sdk
# jsr
npx jsr add @launchdarkly/cloudflare-server-sdk
Then turn on the Node.js compatibility flag in your wrangler.toml
. This allows the SDK to use node:events
:
compatibility_flags = [ "nodejs_compat" ]
If you want to install this package as a JSR package, you will need to use esbuild
version >= 19.7 to enable support for import attributes
.
Initialize the ldClient with your client side sdk key and the Cloudflare KV namespace:
import { init as initLD } from '@launchdarkly/cloudflare-server-sdk';
export default {
async fetch(request: Request, env: Bindings): Promise<Response> {
const clientSideID = 'test-client-side-id';
const flagKey = 'testFlag1';
const context = { kind: 'user', key: 'test-user-key-1' };
// init the ldClient, wait and finally evaluate
const client = initLD(clientSideID, env.LD_KV);
await client.waitForInitialization();
const flagValue = await client.variation(flagKey, context, false);
return new Response(`${flagKey}: ${flagValue}`);
},
};
See the full example app.
# at js-core repo root
yarn && yarn build && cd packages/sdk/cloudflare
# run tests
yarn test
LaunchDarkly uses the SLSA framework (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the provenance guide.
FAQs
Cloudflare LaunchDarkly SDK
We found that @launchdarkly/cloudflare-server-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.
Security News
vlt adds real-time security selectors powered by Socket, enabling developers to query and analyze package risks directly in their dependency graph.
Security News
CISA extended MITRE’s CVE contract by 11 months, avoiding a shutdown but leaving long-term governance and coordination issues unresolved.