https://www.growthbook.io/ logo
#announcements
Title
# announcements
g

gorgeous-translator-85551

06/19/2023, 12:23 PM
Hi! We are running a self-hosted version of GrowthBook including the proxy. Everything is running fine and we are about to run our first A/A-tests. We are using both a react client side implementation along with a Hybrid SSR solution with Next.js in two different apps. One issue I’m having is that the SDK seems (?) to subscribe to events from the proxy which fail (see image below). The proxy does not have
USE_HTTP2
set to
true
. I haven’t setup the proxy personally but I would like to check here to understand what might be wrong before I try to make any changes I have tried passing
autoRefresh: false
to
loadFeatures()
but seems to have no effect. Shouldn’t the client (the react SDK in my case) be able to opt out of this? Or is there anything else that could be wrong with our setup? Thanks!
Forgot to add we are running:
growthbook 2.2.0
@growthbook/growthbook-react: "0.17.0"
h

happy-autumn-40938

06/19/2023, 5:17 PM
Hmm, I haven't seen this one yet. By any chance do you have browser cache disabled in your Chrome developer tools? Also,
autoRefresh: false
should effectively shut off SSE subscriptions. If it's not doing so, this may be a bug in our SDK. I'll have a look
Update: I misspoke on this one. You'd actually want to use this call to disable SSE:
Copy code
configureCache({
  backgroundSync: false,
});
g

gorgeous-translator-85551

06/20/2023, 2:58 PM
The removal of disable cache in chrome dev-tools made no difference.
Copy code
configureCache({
  backgroundSync: false,
});
This seems to work though! Any tips on when to run this? Right now I do it right after setting up the GrowthBook instance and it seems to work fine. Any disadvantages in turning of background sync? (apart for the absence of SSE)
h

happy-autumn-40938

06/21/2023, 5:17 PM
I'm with you: this setting (backgroundSync) can be confusing, and that we should do more to explain its usage! The answer is nuanced and depends on whether you're in a backend versus frontend context. And yes, you can set this setting right after SDK instantiation. On the backend, you'll typically want this disabled. Since SDK instances are per user request, you could have several created at the same time within a Node/express context. In such a context, there will be one central "feature repository" singleton running locally that is responsible for updating all of the SDK instances. It would normally manage the SSE connections to your SDK instances. But because these sessions are short lived, you really don't need each SDK instance synced. In fact, leaving it turned on could possibly lead to slow memory leaks in Node. On the frontend, you would likely want this enabled (but only if you care about real time updates). It ensures that SSE is running with your single FE SDK instance. In a hybrid setting, you may consider decoupling the FE and BE SDKs (use the React SDK on the FE, Javascript SDK on the BE, for example). Then you could set each backgroundSync separately.
11 Views