Hey, all. I've already been able to integrate dire...
# ask-questions
r
Hey, all. I've already been able to integrate direct API access into my app, but now I'm attempting to setup the GB proxy using the standalone instructions; however, I'm a bit confused on a few points there (I'm not crazy familiar with docker, so that's probably why). First, what exactly should
GROWTHBOOK_API_HOST
be? Should it be
<https://cdn.growthbook.io>
or
<https://cdn.growthbook.io/api/features/{client_key}>
? If I use the former, I get a 400 error in my docker logs, but then I get a 401 error with the latter. I'm leaning toward needing the latter. No matter what I use, I get this for the health check:
Copy code
{
  "ok": true,
  "proxyVersion": "1.1.3",
  "build": {
    "sha": "",
    "date": ""
  }
}
Second, are the instructions here something I need to set in docker or are those environment variables I need to set in my application? Finally, for this section, I assume the
apiHost
should be
<http://localhost:3300>
since I'm currently setting this up locally. Is that correct? Any help answering these questions would be very appreciated. Thanks in advance!
I finally got it kind of working, so I'll record what I did here for anyone else. Here are the answers to the three questions I asked: 1. The
GROWTHBOOK_API_HOST
should just be
<https://cdn.growthbook.io/>
. 2. I set the environment variables in my zshrc file. 3. At first I had this as
<http://localhost:3300>
, but that wasn't working properly. I ended up running an ngrok server pointed to port 3300 and that's able to form a connection. A few other things to note that the docs don't specify: • Make sure your SDK connection(s) have the options shown in the image set properly. For the url, I provided my proxy url. • Use the proxy url in your code for the
apiHost
property. The reason I say I kind of got it working is because the SDK connection is complete as seen in my second screenshot, but for some reason, I'm getting false back for all of my feature flags. The problem with the ngrok server though is that it's not letting me view the actual response from the GB API and makes it hard to troubleshoot. If anyone has ideas, please let me know. I might try setting the proxy up in AWS and see if that gets me any other results.
h
Hi Jace, glad you mostly got things working. To chime in on your answers: 1. Correct, GrowthBook Cloud users would set GROWTHBOOK_API_HOST to
<https://cdn.growthbook.io>
(I believe without the trailing slash) 2. .zshrc, which is specific to ZSH, is where you could set a global environment variable across your entire system. If you wanted to set a local variable you'd add a
.env.local
file to the project root (when running the codebase directly, it's in
/packages/apps/proxy/
). However, for deployment you'd need to use whatever provisioning mechanism specific to your vendor to set the env variables. 3. I've had mixed luck running with ngrok, but your mileage may vary. For actual deployments however, you probably wouldn't use any sort of tunneling. 4. Yes, you do need to set your proxy location per SDK Connection if you're using GrowthBook Cloud. 5. Correct, point your SDK endpoints at your own proxy. A rare exception would be if you're running hybrid (i.e. features endpoint pointing to your proxy, streaming endpoint pointing to our CDN).
r
Thanks, Bryce. After looking at your answers and checking everything, I think it just comes down to using ngrok. I was hoping to get the proxy setup locally first, but now I'll just try aws.