Hi, I'm from <houseofmath.com>'s infrastructure team, following up on an email from <@U01T6HCHD0A> ...
s

Shahadat Hossain

almost 2 years ago
Hi, I'm from houseofmath.com's infrastructure team, following up on an email from @Graham We are utilizing Growthbook Cloud, Pro and the associated Growthbook Proxy. The proxy is served via Google Cloud Platform, hosted on Cloud Run, which is basically running a proxy docker container that autoscales according to traffic and load. It is also using the Redis cache option, connected to our google managed redis instance. My setup involves a Next.js application hosted on Vercel, integrated with Growthbook through the proxy. The SDK is configured to use the proxy URL, ciphered payload (all 3 options checked), and visual experiments are enabled. The issue I'm encountering is continuous printing of the following in my logs:
| {"level":50,"time":1698754816784,"pid":43,"hostname":"localhost","err":{"type":"SyntaxError","message":"Unexpected token < in JSON at position 0","stack":"SyntaxError: Unexpected token < in JSON at position 0\n    at JSON.parse (<anonymous>)\n    at parseJSONFromBytes (node:internal/deps/undici/undici:6662:19)\n    at successSteps (node:internal/deps/undici/undici:6636:27)\n    at node:internal/deps/undici/undici:1236:60\n    at node:internal/process/task_queues:140:7\n    at AsyncResource.runInAsyncScope (node:async_hooks:203:9)\n    at AsyncResource.runMicrotask (node:internal/process/task_queues:137:8)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"},"msg":"polling error"}
Additionally, on inspecting the website's network tabs, the API calls are successful through the proxy URL. However, all eventstream requests are failing, displaying
"No channel found."
Interestingly, when I use the normal Growthbook URL instead of the proxy, the eventstream works without issues. I'd appreciate any insights or guidance on this matter. I have attached some screenshots. Thank you.
1
Hi guys, been using the growth book at my org for the last few months and am quite amazed by its eas...
a

Abhushan Adhikari

over 3 years ago
Hi guys, been using the growth book at my org for the last few months and am quite amazed by its ease of use from a developer's perspective. I just wanted to know if there should also be sections in docs specified on how to use it in an SSR context, especially with frameworks like Next.js and Remix. ? The reason is, that I think it might help developers take the right approach based on their framework type. Considering the docs show the usage strictly on client which is not very suitable due to flickering/CLS/ blocking UI and that can be avoided easily if you have SSR react in some way... Maybe we can add a section in the context of the SSR application where essentially we do the same but on the server data fetcher logic and still pass the features list to the provider. One possible way in Next.js specific could be something along the lines of
export const getServerSideProps= async ()=>{
 const gbFeatures= await fetchGrowthbookFeatures();

 return {
  gbFeatures
 }

}
On my
_app.tsx
I did something or of sort
const growthbook = useMemo(()=>{
 return new Growthbook({
    features: pageProps?.gbFeatures?.features,
     attributes: ....// we can set them here as well
 })
},[pageProps])
useEffect(()=>{
  if( pageProps?.gbFeatures) return ;  // since SSR handled it

fetch('apiendpoint').then()//// the usual client approach as per doc
 
},[growthbook, pageProps?.gbFeatures?])
<GrowthbookProvider growthbook={growthbook}>{children}</GrowthbookProvider>
Any thoughts on this? Happy to contribute and raise a PR..