GrowthBook "Failed to fetch features" in CI
The GrowthBook SDK called loadFeatures and could not retrieve the feature definitions from the API host (GrowthBook Cloud or a self-hosted instance). Either the client key or apiHost is wrong, or the host is unreachable. Until features load, every isOn / getFeatureValue returns the fallback.
What this error means
GrowthBook logs "Failed to fetch features" or loadFeatures rejects, and feature checks all return their default because the feature map is empty.
[GrowthBook] Failed to fetch features:
GET https://cdn.growthbook.io/api/features/<clientKey> 404 (Not Found)Common causes
The client key or apiHost is wrong
A mistyped client key, or an apiHost that does not match your GrowthBook deployment, returns 404 or the wrong payload.
The API host is unreachable from the runner
Egress to the GrowthBook CDN or self-hosted API is blocked, so loadFeatures cannot complete.
How to fix it
Set the correct apiHost and client key, and await loadFeatures
- Copy the API host and SDK client key from GrowthBook, SDK Connections.
- Pass them into the client and await loadFeatures before evaluating.
- For self-hosted, point apiHost at your instance, not the cloud CDN.
const gb = new GrowthBook({
apiHost: 'https://cdn.growthbook.io',
clientKey: process.env.GROWTHBOOK_CLIENT_KEY,
});
await gb.loadFeatures();Provide features directly for offline tests
Pass a features payload so evaluation is deterministic and needs no network fetch.
const gb = new GrowthBook({
features: require('./growthbook-features.json'),
});How to prevent it
- Keep the GrowthBook client key in CI secrets and set the right apiHost.
- Await loadFeatures before any feature evaluation.
- Pass features directly in tests to remove the network dependency.