Giter Site home page Giter Site logo

launchdarkly / cloudflare-edge-sdk Goto Github PK

View Code? Open in Web Editor NEW
3.0 33.0 3.0 169 KB

LaunchDarkly Server-side SDK for Cloudflare Workers

License: Other

JavaScript 72.14% Shell 22.24% TypeScript 5.62%
feature-flags feature-toggles experimentation launchdarkly launchdarkly-sdk sdk managed-by-terraform mirror

cloudflare-edge-sdk's Introduction

LaunchDarkly Edge SDK for Cloudflare

CircleCI

Important note

As mentioned in the repository changelog, the cloudflare-edge-sdk project has been renamed to cloudflare-server-sdk. All future releases will be made from the new repository. Please consider upgrading and filing potential requests in that repository's issue tracker.

v1.x readme

This library supports using Cloudflare Workers KV to replace the default in-memory feature store of the LaunchDarkly Node.js SDK.

For more information, see the SDK features guide.

Quick setup

  1. Install this package with npm:

    npm install launchdarkly-cloudflare-edge-sdk --save
    
  2. Require the package:

    const { init } = require('launchdarkly-cloudflare-edge-sdk');
  3. When configuring your SDK client, initialize with the Cloudflare KV namespace:

    const client = init(KV_NAMESPACE, 'YOUR CLIENT-SIDE SDK KEY');

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read our documentation for a complete list.
  • Explore LaunchDarkly

cloudflare-edge-sdk's People

Contributors

alsmola avatar carmenquan avatar dependabot[bot] avatar intheclouddan avatar jazanne avatar kparkinson-ld avatar launchdarklyreleasebot avatar ld-repository-standards[bot] avatar ldhenry avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

dandean

cloudflare-edge-sdk's Issues

Not working on Cloudflare Workers...

"edge-sdk" imply to me that you can run this lib on the edge, which means, no node dependencies...
When running on Cloudflare workers this lib fails to a fair amount of dependencies to crypto and os

Incorrect TypeScript module definition

Describe the bug

It appears that the type definitions for this module are incorrect. When I import this module I get the following message:

image

If I open up the type definition file and remove /client from the end of the module declaration it works fine.

Before:

image

After:

image

TypeScript's language server is now happy:

image

To reproduce

See above.

Expected behavior

The module declaration matches the exported JavaScript source.

SDK version

^0.1.0

Language version, developer tools

Node 14.8.1

cloudflare-edge-sdk docs/usage do not work, as written, with latest version of wrangler

Describe the bug
When the CloudFlare worker code executes, several issues arise:

  • Wrangler complains of node builtIns usage. The CLI recommends adding the following to the wrangler.toml:
node_compat = true
  • After adding the above config, the code is able to build successfully, but a new runtime exception is thrown for these lines:
const ldClient = init(LD_KV_NAME, LD_CLIENT_SIDE_ID)
await ldClient.waitForInitialization()

exception

Uncaught TypeError: globalThis.XMLHttpRequest is not a constructor

To reproduce

  1. Follow steps outline in this Launchdarkly article with the latest version of wrangler
  2. npx wrangler dev

Expected behavior

  1. The LD Client should be able to initialize
  2. The LD Client should not require opting out of wrangler's default build
  3. IF a separate build is required as a stop-gap, it should be clearly documented for the latest version of wrangler

Logs
If applicable, add any log output related to your problem.

SDK version

  "dependencies": {
    "launchdarkly-cloudflare-edge-sdk": "^1.0.0"
  },
  "devDependencies": {
    "@types/node": "^18.8.5",
    "typescript": "^4.8.4",
    "wrangler": "2.1.11"
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.