Skip to content

Conversation

blurrah
Copy link

@blurrah blurrah commented Sep 5, 2025

This adds an Optimizely adapter for use with the flag() function.

It optimizes Optimizely (hah) for use with serverless/edge runtimes by offloading event dispatches to waitUntil() and sets up fetch() as a request handler instead of node https.

This is still a naive implementation where each individual event dispatch (if you're tracking experiments for the flag) gets added to waitUntil(). There's no batching or time based flushing happening for longer living instances.

The adapter has the following functions:

  • decide() to decide on a feature flag, can be directly used as adapter
  • userContext() which returns a user context interface so users can track events for example, more of a helper function Dropped this for now as I need to properly make it work with a deduped identify function
  • initialize() to get an initialized Optimizely instance

Based off of #175 for now so I can import their universal SDK.

Extra notes:

  • Was playing around with pnpm versions to link so I remade the lockfile a few times 🙈

Copy link

vercel bot commented Sep 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
flags-sdk-snippets Ready Ready Preview Comment Sep 24, 2025 5:16am
flags-sdk-sveltekit-snippets Ready Ready Preview Comment Sep 24, 2025 5:16am
shirt-shop Ready Ready Preview Comment Sep 24, 2025 5:16am

@blurrah blurrah force-pushed the optimizely-adapter-edge branch from eee79dd to eec87bc Compare September 12, 2025 12:03
@blurrah blurrah force-pushed the optimizely-adapter-edge branch from fc98ece to 4da2df3 Compare September 16, 2025 13:27
@dferber90
Copy link
Collaborator

I created a snapshot release as v0.2.0-bcd73bd1-20250924051654

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

Successfully merging this pull request may close these issues.

2 participants