Hello Everyone, I trying to make a very basic exam...
# announcements
h
Hello Everyone, I trying to make a very basic example with feature flags on nextjs 13 for record a video demo in youtube, but I still receiving the same value... Anyone know if it's is compatible or what's wrongs with me? 😛
f
hi Felipe
h
hey
f
probably a cache delay - let me enable real time updates for your SDK
h
ohh ok
I added
_await_ growthbook.loadFeatures({ autoRefresh: true, skipCache: true });
skipCache on the loadFeatures...
It resolves?
f
try it now
1
h
I don't know why, but still ignoring the force rule 😕
f
Can you add a log of the getFeatures()?
h
yep
just console.log('running') resolve?
f
well, I don’t see you setting the apiHost anywhere
h
Copy code
const growthbook = new GrowthBook({
  apiHost: "<https://cdn.growthbook.io>",
  clientKey: "sdk-HZXDl2WDRqjPt9CJ",
  enableDevMode: true,
  trackingCallback: (experiment, result) => {
    // TODO: Use your real analytics tracking system
    console.log("Viewed Experiment", {
      experimentId: experiment.key,
      variationId: result.key,
    });
  },
});
f
ah
h
image.png
feature is loading...
f
add
console.log("all features", growthbook.getFeatures());
around line 27
h
bingo
f
huh
my-feature-1 is an old feature you had?
h
yep
these are the new values
f
@happy-autumn-40938 do you know why the cache would not be clearing?
h
I don't think I would use
skipCache: true
unless there's a good reason to do so. In this case, it might be doing more harm than good. The CDN-cached payload (which incidentally uses a separate cache than what is controlled by
skipCache
in the SDK) is sometimes slow to respond to updates. We're actively working on resolving this. Meanwhile, streaming updates should allow your SDK to respond to GB changes more quickly. I'd want to know whether you're able to receive streaming updates. You can check your Chrome network tab and filter for our
/sub
endpoint. As you toggle/modify a feature flag in the app, you should see a corresponding event appear on this endpoint. I'd start there and see whether that's actually updating for you.
h
Hello Bryce,
skipCache
disabled. And I can't receive streaming updates (I'm using the free account to make a youtube video for my channel using next + gb)
h
Ah, that could be it. We do have a free trial of Pro (self-serve) that should unlock streaming for you. No payment info required, it just turns off after the trial period. Please let us know if you'd like help getting everything set up.
h
Ok! I see... I'll try so. Thanks so much Bryce and Graham ❤️
🥳 1
I don't know it is relevant, but when I create a new SDK it's "reloads" the cache and the new values are in.
Look for before and after in my console.
h
yep that makes sense. The CDN caches by api key.
h
But in this case, I up the docker image on my PC (it's running localhost)
I upped a docker container to skip cache issues, and this keep occurring.
I'll try to use next using react on the browser (as client) and see if keep the same pattern.
h
I see. On self-hosted, the SDK endpoint is not cached by a CDN unless you set it up manually. At this point, you'd mostly be dealing with SDK and network cache
Locally, to reduce the SDK cache time, you can try setting:
Copy code
configureCache({
  staleTTL: 100 // 0.1 seconds
});
h
Where I put this code?
h
right after initializing your SDK
(line 15 for you)
1