Hello GrowthBook Team, We are currently trying to ...
# ask-questions
n
Hello GrowthBook Team, We are currently trying to integrate GrowthBook (self-hosted) into our service, but we’re facing an issue with the SDK. When we initialize GrowthBook in our repo, the feature flag evaluation always returns
false
, and the feature list is empty. However, if we check the API directly from the GrowthBook dashboard, we can see that the features are available, and the feature flag
FF
should return
true
. Here’s the snippet of our code:
Copy code
routes.get('/test-ff', authMiddleware.closedAuth, async (req: any, res) => {
        const gb = new GrowthBook({
            apiHost: process.env.GROWTHBOOK_API_HOST,
            clientKey: process.env.GROWTHBOOK_CLIENT_KEY,
            enableDevMode: true,
            subscribeToChanges: true,
            attributes: {
                id: '123',
                country: 'US',
            },
            trackingCallback: (experiment: any, result: any) => {
                console.log('Experiment Viewed', {
                    experimentId: experiment.key,
                    variationId: result.key,
                });
            },
        });

        try {
            await gb.init();
        } catch (error) {
            console.log('Error', error);
        }

        if (gb.isOn('FF')) {
            res.send('Feature is enabled!');
        } else {
            res.send('Feature is disabled');
        }
    });
Do we need additional configuration for self-hosted GrowthBook in order for the SDK to fetch the features? Or is there something we might have missed here response from api (SDK Connection) on dashboard
Copy code
{
  "status": 200,
  "features": {
    "FF": {
      "defaultValue": true
    }
  },
  "experiments": [],
  "dateUpdated": "2025-10-01T07:14:23.643Z"
}
s
I'd log
gb
after init and see what the values are there. Also, if the endpoint can't be reached for some reason,
gb.init()
won't throw an error. So, if it's not connecting in that try/catch, you won't actually see anything. Instead, you need to handle the response:
const initRes = await gb.init();
n
case closed, the proble because i use old node (node 16) , gb need fetch to hit gb api