So I am trying to run growthbook self hosted on my...
# ask-questions
m
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
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
This is how my docker-compose.yml looks like:
f
did you edit the JWT_SECRET string?
m
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
if you go directly to the API host, can you see it returning a small JSON object?
m
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
you shouldnt get a CORS error when accessing the url directly
m
Do I need ssl certificate to be able to do this self hosted?
f
no
are you doing https?
m
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
are you using the public SDK end point or the API?
what url are you hitting?
m
I am using the Full api endpoint from the React config settings:
f
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
ah my bad I am using too long url I think
f
or you can read more about the api here: https://docs.growthbook.io/api
m
yeah my bad now it’s working as expected, sorry to bother you 😄