Hi, Need some understanding regarding a issue we f...
# ask-questions
m
Hi, Need some understanding regarding a issue we faced recently had. We have pro plan and recently we integrated growthbook SDK and it seems to be working fine in the beginning but later worker started throwing 499 for some request. Upon investigating we found that the wall time of worker increased drastically. Which correlates with 499 error count.
f
I wonder if that is related to the server sent events
which SDK?
m
f
Do you have
Copy code
streaming: true,
?
m
Copy code
var _growthBookClient = null;
function initialiseGrowthBook(attributes, env) {
  console.log(attributes, "attributes");
  const growthbook = new GrowthBook({
    apiHost: env.GROWTHBOOK_SDK_CLIENT_PATH,
    clientKey: env.GROWTHBOOK_SDK_KEY,
    enableDevMode: true,
    disableCache: true,
    subscribeToChanges: true,
    trackingCallback: /* @__PURE__ */ __name((experiment, result) => {
      console.log("Viewed Experiment Growthbook fetchFeatureFlagValue", {
        experimentId: experiment.key,
        variationId: result.key
      });
    }, "trackingCallback")
  });
  configureCache({
    // Set to `true` to completely disable both in-memory and persistent caching
    disableCache: false
  });
  if (growthbook.init) {
    growthbook.init({ timeout: 2e3 });
  }
  if (growthbook.setAttributes) {
    growthbook.setAttributes(attributes);
  }
  _growthBookClient = growthbook;
}
__name(initialiseGrowthBook, "initialiseGrowthBook");
async function fetchFeatureFlagValue(featureFlag, featureFlagFallback) {
  if (!_growthBookClient) {
    throw new Error("GrowthBook client not initialized");
  }
  await _growthBookClient.loadFeatures();
  let value = featureFlagFallback;
  value = _growthBookClient.getFeatureValue(featureFlag, featureFlagFallback);
  console.log(
    "fetchFeatureFlagValue Feature is not enabled!",
    featureFlag,
    featureFlagFallback,
    value,
    // _growthBookClient,
    _growthBookClient.getFeatureValue(featureFlag, featureFlagFallback),
    _growthBookClient.evalFeature(featureFlag)
    // _growthBookClient,
  );
  return value;
}
This is the code we used. But i dont think we used streaming
f
doesnt look like it - you also dont seem to have a tracking callback defined
for experiments
oh, you do
Copy code
subscribeToChanges: true,
you can try turning that off to see if it helps
m
Okay Do you think using Growthbook edge package will help?
f
might - what is the primary use case for GrowthBook for you?
m
We need to use it for experimentation. As we have cdn cache, so we need to fetch allocation details at worker edge level only and use the same to show user behaviour It could be possible that user will cached experimetn experience using this approach
which is what we want.
Following up on this…
s
Hey Harshul. Following up here. Couple of things: • Our Edge worker may be beneficial, as you said: https://docs.growthbook.io/lib/edge/cloudflare • the
subscribeToChanges
property is deprecated, so it should be removed. • if you're looking to turn streaming off, you can disable it with
{ streaming: false }