https://www.growthbook.io/ logo
m

miniature-agency-3305

05/18/2023, 12:43 PM
So I am trying to run growthbook self hosted on my server but I run into the following issue:
Copy code
Error connecting to the GrowthBook API at http://<my-server-ip>:3100.
I have added these variables in my docker-compose.yml:
Copy code
environment:
      - APP_ORIGIN=http://<my-server-ip>:3000
      - API_HOST=http://<my-server-ip>:3100
removed my ip from the example above but it does not seem to be working, I still get the issue. Does someone know why?
f

fresh-football-47124

05/18/2023, 1:47 PM
Hi Anton
usually this is because you haven’t changed the JWT secret in the env settings
you should be able to go to the API url directly and see a json object returned
you’ll also find the API will log the error, if you check the container logs
m

miniature-agency-3305

05/18/2023, 2:00 PM
This is how my docker-compose.yml looks like:
f

fresh-football-47124

05/18/2023, 2:05 PM
did you edit the JWT_SECRET string?
m

miniature-agency-3305

05/18/2023, 2:05 PM
I am wondering if it could be something cors related since I’m trying to access it from a browser outside of my server?
Copy code
strict-origin-when-cross-origin
Yeah I just added the JWT_SECRET string, I didn’t have it before.
f

fresh-football-47124

05/18/2023, 2:05 PM
if you go directly to the API host, can you see it returning a small JSON object?
m

miniature-agency-3305

05/18/2023, 2:07 PM
No, I get a:
Copy code
strict-origin-when-cross-origin
on trying to access the url for API_HOST
If I do it in postman I get a: Error: connect ECONNREFUSED
f

fresh-football-47124

05/18/2023, 2:10 PM
you shouldnt get a CORS error when accessing the url directly
m

miniature-agency-3305

05/18/2023, 2:11 PM
Do I need ssl certificate to be able to do this self hosted?
f

fresh-football-47124

05/18/2023, 2:11 PM
no
are you doing https?
m

miniature-agency-3305

05/18/2023, 2:12 PM
Nope, I am doing http.
So now it’s working to access the admin panel, is there something extra that needs to be passed from the client now that I have JWT_SCRET and Encryption key setup? When I’m trying to access the feature toggles from the React Native client using the React SDK I get: No authorization token was found Do I need to have authorization setup and setting a token_endpoint or is that optional? Pretty much the only thing I wanna be doing is fetching a json with feature toggles for the user.
Do you have any idea? @fresh-football-47124
f

fresh-football-47124

05/19/2023, 2:59 PM
are you using the public SDK end point or the API?
what url are you hitting?
m

miniature-agency-3305

05/19/2023, 3:15 PM
I am using the Full api endpoint from the React config settings:
f

fresh-football-47124

05/19/2023, 3:17 PM
ya, thats the API end point
if you’re looking to fetch the features for use in your code, we suggest you use an SDK end point
m

miniature-agency-3305

05/19/2023, 3:18 PM
ah my bad I am using too long url I think
f

fresh-football-47124

05/19/2023, 3:18 PM
or you can read more about the api here: https://docs.growthbook.io/api
m

miniature-agency-3305

05/19/2023, 3:18 PM
yeah my bad now it’s working as expected, sorry to bother you 😄
4 Views