I'm sure I'm missing something obvious, but can an...
# ask-questions
d
I'm sure I'm missing something obvious, but can anyone point me to what it might be?
I have two test features set up, each with a set of variations to return a random number between 3 and 9. Both are set to split users by
id
and include 100% of users in the experiment. Both are enabled for the environment, and the SDK panel shows I'm connected to my site. I've set the
id
to the GA4
clientId
, and I've confirmed it's being set — dumping the GB object shows context.attributes.id is "559138431.1675724983" for me. evalFeature on either of the features returns
{value: null, on: false, off: true, source: "unknownFeature", ruleId: ""}
and in the Chrome extension they're coming back as "> Skip because missing hashAttribute > Use default value"
Copy code
/*...*/
            clientId = await new Promise((resolve, reject) => {
                gtag('get', gaPropertyId, 'client_id', function(id) {
                    resolve(id);
                });
/*...*/

   const gb = new GrowthBook({
        apiHost: "<https://cdn.growthbook.io>",
        clientKey: sdkKey,
        enableDevMode: true,
        attributes: {
            id: clientId
        },
/*...*/
Screenshot 2023-06-26 at 9.05.59 PM.png
f
Sounds like there might be a race condition
d
gooooood call, waiting to make sure the clientId was set before initializing GB seems to have done the trick. thank you!