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 was archived by the owner on May 30, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on May 30, 2024. It is now read-only.
Unable to get feature flag using variation method #154
I am trying to integrate node-server-sdk in my application. I am able to initialize Launch darkly with sdk-key. Also i am getting available flags using allFlagsState .
ldClient = LaunchDarkly.init("sdk-key");
ldClient.allFlagsState({}, function(err, flagsState) {
//Here I am getting all available feature flags
var flagStateProps = flagsState.toJSON()['$flagsState'];
console.log("All available feature flags", flagStateProps);
});
When i am trying to check flag availability using variation method, i am always getting false as response, where this flag is available in allFlags.
Following is the code for the same.
I see that you've already closed your issue. As a result I assume that you've identified and resolved your problem.
While I'm here, I want to point you to our SDK documentation which has information about how to use the variation method as well as other SDK features.
This particular issue is actually a support request and not a SDK bug report. Don't hesitate to reach out to support@launchdarkly.com for additional help adopting the Node Server SDK in your application.
For the record, briefly, the two problems I see in this code are 1. you don't have a valid user object (users should have at least a key) and 2. var flagStateProps = flagsState.toJSON()['$flagsState'] does not give you the flag values, it gives you some metadata containing objects which might look like a true flag value to you because objects are always "truthy"; what you want is just var flagStateProps = flagsState.allValues().
Activity
[-]Unable to get enable flags through variation method[/-][+]Unable to get feature flag using variation method[/+]bwoskow-ld commentedon Jul 24, 2019
Hi @VarshaKamble159 ,
I see that you've already closed your issue. As a result I assume that you've identified and resolved your problem.
While I'm here, I want to point you to our SDK documentation which has information about how to use the
variationmethod as well as other SDK features.This particular issue is actually a support request and not a SDK bug report. Don't hesitate to reach out to support@launchdarkly.com for additional help adopting the Node Server SDK in your application.
Cheers,
Ben
eli-darkly commentedon Jul 24, 2019
For the record, briefly, the two problems I see in this code are 1. you don't have a valid user object (users should have at least a key) and 2.
var flagStateProps = flagsState.toJSON()['$flagsState']does not give you the flag values, it gives you some metadata containing objects which might look like a true flag value to you because objects are always "truthy"; what you want is justvar flagStateProps = flagsState.allValues().VarshaKamble159 commentedon Jul 25, 2019
Hi @eli-darkly and @bwoskow-ld ,
Thank you so much guys for your replies. Yes, i identified the issue in my code and was able to solve it.
I appreciate your response.
Will surely reach out to you guys in case of any further help.
Thanks,
Varsha
Merge pull request #154 from launchdarkly/eb/ch53636/redis-intf