Hi, I am working on setting up AB testing using fe...
# ask-questions
c
Hi, I am working on setting up AB testing using feature flags and am running into an issue using the feature flag. Using growthbook dev tools I see that the feature flag is set to true for the current user but when I console.log the value of the flag it is false even though it is true in dev tools.
const enabled = useFeatureIsOn("trackingKey");
This is my first time using growthbook and might be missing something simple. Why could this be happening? The enviroment is enabled,
trackingKey
matches, changes are published.
b
Hi Tyler, thanks for reaching out! I'll ask one of our engineers who specializes in the Dev Tools feature and get back to you as soon as I can with an update to your question
c
I have added gb.loadFeatures({autoRefresh:true}) but still occasionally I get the wrong variant initially until the page is refreshed
b
Hey Tyler, do you have only one Environment set up in GrowthBook? If you have more than one Environment, as a first debugging step, could you confirm that the Environment you set the Feature Flags in in the dashboard is the same Environment you're using in the Dev Tools pane?
c
Yes I have two environments set up dev and prod. The sdk connection was made with dev and works fine but only when adding an additional environment using the same sdk connection stops working properly. The feature flags show true in the dev console but in the logs show false. Could this be a race condition if there are missing assignment attributes being populated later on page load?
b
Ah! Each environment needs to be using it's own SDK key. Could you please try creating a new production environment with its own SDK key?
c
Yes this is true both env have an sdk connection but the problem is when I am connected to dev after creating prod without switching any connection yet the sdk stops pulling the feature flag value.