statsig-io / node-js-server-sdk

Statsig's SDK for server-side Node.js applications.
ISC License
21 stars 14 forks source link

`localOverride` persistance - How does it work? #33

Closed simonlovesyou closed 1 year ago

simonlovesyou commented 1 year ago

I'm looking for clarifications on how Statsig.localOverride works. I tried reading the documentation but am still unsure.

Context: I'm building a "statsig devtools" for Next.js server components for our team and would like to offer t*he ability to override a feature gate or experiment through these devtools. However, the override is not persisted in any way when navigating in the application. It only really works for the current page that the developer is on.

Is this expected behavior? I understand that the override is not persisted on the network in any way, but am unsure to what extent it's supposed to persisted (if at all). If it's supposed to be persisted, to what extent, and what can I do to make sure it doesn't default back to the statsig network?

Thank you in advance :)

Reference

Statsig Docs | Node.js Server SDK # localOverrides

tore-statsig commented 1 year ago

If you're using the node SDK, we dont persist overrides anywhere. It should keep it in memory, so subsequent checks on that server should still have the override - are you hitting a different server on different pages, perhaps?

simonlovesyou commented 1 year ago

That makes sense! We're not experiencing it being persisted when using the next.js dev server and navigating between app router pages (a local override is always reset when navigating), I'll do some more testing on our side and if we can't get it to work then I can create a reproducible repository for you. Feel free to close this until then, I've gotten the clarifications I needed :) Thank you!

tore-statsig commented 1 year ago

Hmm do let us know if this continues or you have a reproducible example. The node SDK overrides do allow you to override just per user, OR globally - if you dont provide a userID as the last argument, that might be what you are looking for

tore-statsig commented 1 year ago

closing for now