Hi, I am starting with growthbook and have created...
# ask-questions
b
Hi, I am starting with growthbook and have created a feature, but when I log the JSON from growthbook.evalFeature("feature_id") on the browser console it always returns that it is off. I am not Self Hosting. Does anyone have an idea of what can be missing?
f
Can you log
growthbook.getFeatures()
? That should return all of the features loaded into the SDK
b
It is empty this object
But I can log the features I have for my environment
f
Hmm. So it's setting the features correctly at first, but when you later do
getFeatures()
it returns an empty object? Is there anywhere else in your code that is calling
setFeatures()
? Are you sure it's the exact same instance of GrowthBook and you aren't creating multiple ones?
b
maybe an obvious one, but just in case - you mentioned logging:
growthbook.evalFeature("feature_id")
But your feature is
hide-element
, not
feature_id
Or were you actually logging:
growthbook.evalFeature("hide-element")
b
The feature_id was an example, but thanks anyway!
@future-teacher-7046 Exactly, when I do
getFeatures()
returns an empty object. I'm calling the
setFeatures()
only once
Can it be any other configuration in the app?
f
You are calling
setFeatures()
inside of an async callback. Is it possible when you log
getFeatures()
it's before the fetch is done?
b
Yes, it seams that it is happening