Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with isomorphic client? #16

Open
jamesarosen opened this issue Jul 23, 2024 · 1 comment
Open

Compatible with isomorphic client? #16

jamesarosen opened this issue Jul 23, 2024 · 1 comment

Comments

@jamesarosen
Copy link

jamesarosen commented Jul 23, 2024

Question / Problem

Is the Vercel edge integration compatible with the isomorphic JavaScript library?

The docs for configuring with Vercel's Edge runtime say to use PluggableStorage and ErrorLogger, but neither is exported from @splitsoftware/splitio.

Why I Care / Use-Case

I have a Vercel application that includes some code that runs on the Edge runtime and some in the Serverless (Node) runtime. I use feature flags in both runtimes. I want the logic for handling feature flags to be consistent across the two runtimes and I don't want to maintain two implementations / integrations with Split.

Both packages declare the same SplitIO Typescript namespace, which results in collisions like this one:

split-io-js-vs-browser

Background

The public API for javascript-client has diverged from the one for javascript-browser-client. For example,

// javascript-client:
const factory = SplitFactory({
  core: {
    authorizationKey: 'YOUR_SDK_KEY'
  }
});

var client = factory.client();

// ...

client.getTreatment('user id', 'treatment name')

versus

// javascript-browser-client:
const factory = SplitFactory({
  core: {
    authorizationKey: 'YOUR_SDK_KEY',
    key: 'user id',
  }
});

var client = factory.client();

// ...

client.getTreatment('treatment name')

See also splitio/javascript-client#781

@EmilianoSanchez
Copy link
Contributor

EmilianoSanchez commented Jul 31, 2024

Hi @jamesarosen ,

As you mentioned, the API of both packages, @splitsoftware/splitio and @splitsoftware/splitio-browserjs, diverge. We plan to unify both APIs but we don't have an ETA yet.

Specifically, the @splitsoftware/splitio API will look like the @splitsoftware/splitio-browserjs one, to support PluggableStorage (i.e., custom storages) for both client-side (client.getTreatment(FEATURE_FLAG_NAME)) and server-side (client.getTreatment(USER_ID, FEATURE_FLAG_NAME)) API styles.

But unfortunately, at the moment, you cannot use PluggableStorage with the @splitsoftware/splitio package, so it is not compatible with the Vercel Edge integration because this requires the EdgeConfigWrapper to connect the SDK to the Edge Config instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants