Skip to content

[@flags-sdk/statsig] upgrade to @statsig/statsig-node-core#373

Draft
dferber90 wants to merge 1 commit intomainfrom
tdf0f
Draft

[@flags-sdk/statsig] upgrade to @statsig/statsig-node-core#373
dferber90 wants to merge 1 commit intomainfrom
tdf0f

Conversation

@dferber90
Copy link
Copy Markdown
Collaborator

@dferber90 dferber90 commented May 1, 2026

Summary

Migrates @flags-sdk/statsig from statsig-node-lite + statsig-node-vercel to Statsig's new Rust-based SDK @statsig/statsig-node-core. Released as a major (1.0.0) — breaking changes for consumers.

Changes

  • New SDK: replaces the singleton Statsig from statsig-node-lite with the instance-based new Statsig(key, options) from @statsig/statsig-node-core. Methods drop the Sync suffix and the *WithExposureLoggingDisabledSync variants — pass { disableExposureLogging: true } instead.
  • Options: dataAdapterdataStore, rulesetsSyncIntervalMsspecsSyncIntervalMs, dropped disableIdListsSync / initStrategyForIDLists (the new SDK defaults to ID lists off).
  • Experiment is now exported as its own type (was aliased to DynamicConfig); the experiment adapter getter receives an Experiment.
  • Edge Config integration: statsig-node-vercel is still pinned to statsig-node-lite, so I dropped that dependency and inlined a DataStore that reads from @vercel/edge-config directly. It accepts both the legacy statsig.cache key and the new statsig|/v[12]/download_config_specs|... key shapes the core SDK uses.
  • Edge Runtime hooks deleted: removed src/edge-runtime-hooks.ts and the manual syncConfigSpecs() workaround. The new SDK uses NAPI native bindings, so it runs on Node.js / Fluid Compute only.
  • Docs (apps/docs/content/docs/providers/statsig.mdx): updated bootstrap example (getClientInitializeResponse returns a JSON string and accepts hashAlgorithm instead of hash), updated the "Initializing" caveat to use the instance returned by statsigAdapter.initialize(), and renamed the "Statsig Node Lite" section.

Trade-offs to call out

  • JSON.stringify overhead on Edge Config reads. Vercel Edge Config returns parsed JSON objects, but the new SDK's DataStore.get requires a string. The inline createEdgeConfigDataStore re-stringifies the object on every read the SDK makes. For large spec payloads this is non-trivial CPU work per sync interval — worth keeping an eye on if you have a high specsSyncIntervalMs or very large rulesets. (Once Statsig ships a core-compatible statsig-node-vercel, we can swap to it and likely avoid the round-trip.)
  • No more Edge Runtime support. @statsig/statsig-node-core ships native NAPI bindings (Rust), which the Edge Runtime cannot load. Apps using this adapter in Edge middleware/functions must move to the Node.js runtime (Vercel's default Fluid Compute is fine). This aligns with current Vercel guidance — Routing Middleware now runs on Node — but it is a hard break for any consumer still on Edge.

Test plan

  • pnpm install
  • pnpm --filter @flags-sdk/statsig type-check
  • pnpm --filter @flags-sdk/statsig check (biome)
  • pnpm --filter @flags-sdk/statsig build
  • pnpm --filter @flags-sdk/statsig test
  • Smoke test against a real Edge Config item (recommended before publishing) — confirm v1 vs v2 specs path compatibility and that the inline DataStore returns a payload the new SDK accepts

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 1, 2026

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

Project Deployment Actions Updated (UTC)
flags-playground Ready Ready Preview, Comment May 1, 2026 6:19am
shirt-shop Ready Ready Preview, Comment May 1, 2026 6:19am
shirt-shop-api Ready Ready Preview, Comment May 1, 2026 6:19am

@socket-security
Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​statsig/​statsig-node-core@​0.19.39810070100100

View full report

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.

1 participant