You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 30, 2024. It is now read-only.
By default allFlagsState does not include reasons for all flags. You can change the behavior by using LDFlagsStateOptions to indicate you want reasons.
Yes, that's what the API docs for getFlagReason mean when they say "it will be null if reasons were not recorded". Reasons are only recorded if you use the option Ryan mentioned.
As background, here's why the default is not to capture reasons. The most common use case for allFlagsState is to produce bootstrap data for initializing the JS SDK. That data will have to be passed in some way to the front end, such as by embedding it in a hidden HTML component, so it's desirable to not make it any bigger than necessary. And most front-end code that uses the JS SDK does not use evaluation reasons— getting them is an opt-in feature for client-side SDKs, even if you are connecting directly to LD and not using bootstrap data. So the reasons are omitted from that data by default.
Is this a support request? No.
Describe the bug
The method
allFlagsState
returns a Promise resolved by an object on whichgetFlagReason(key)
returns alwaysundefined
:Whereas featureDetail which returns the proper object :
To reproduce
Expected behavior
getFlagReason
should return aLDEvaluationReason
object type.Logs
See above.
SDK version
Current sdk version: launchdarkly-node-server-sdk: "5.13.4"
Language version, developer tools
NodeJS 16.1.0
OS/platform
On local env, Mac book pro M1.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: