https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
n

nice-airline-943

08/31/2022, 4:35 AM
👋 Hello, team! I am getting started with self hosted growthbook deployment and trying to deploy it on a EC2 instance. but facing the issue where it can not connect o API's. I did updated the environment variables as per the docs. can you please help to figure out what's wrong?
f

fresh-football-47124

08/31/2022, 4:42 AM
Hi Dheeraj
Are you getting any errors in the console?
And can you test going to that API url directly?
n

nice-airline-943

08/31/2022, 4:45 AM
going to api url directly gives cors origin issue as it is not expecting my personal ip as origin
console and network errors
f

fresh-football-47124

08/31/2022, 4:48 AM
that is not a request directly to the API
can you open the port 3100 url directly?
if its working it should give you a json object back
n

nice-airline-943

08/31/2022, 4:54 AM
it will give me cors origin access issue
I found the issue.
by looking into logs of docker compose
f

fresh-football-47124

08/31/2022, 4:56 AM
cool, what was it?
n

nice-airline-943

08/31/2022, 4:56 AM
you should probably update the docs to change
ENV
to non prod and
JWT_SECRET
is mandatory for PROD
It was asking to provide a random key for
JWT_SECRET
f

fresh-football-47124

08/31/2022, 4:57 AM
ya, if you don’t change it, we throw an error
1
n

nice-airline-943

08/31/2022, 4:58 AM
it wasn't mention anywhere in get started doc
f

fresh-football-47124

08/31/2022, 4:58 AM
ya, I’ll make it clearer
🙏 1
n

nice-airline-943

08/31/2022, 5:04 AM
thankyou so much
f

fresh-football-47124

08/31/2022, 5:09 AM
Updated the self configuration documentation. Added this:
When using GrowthBook in production, it is important to change the
NODE_ENV
to to “production” and change the
JWT_SECRET
to a random string. Using the
production
node environment and the default
JWT_SECRET
will throw an error.
🙏 1
n

nice-airline-943

08/31/2022, 5:37 AM
great. thanks @fresh-football-47124
Just wondering if I provide
APP_ORIGIN
and
API_HOST
it by default assume that's its a prod environment right?
f

fresh-football-47124

08/31/2022, 7:15 AM
We thought about that, but there are cases where that is not true
😟 1
e

enough-camera-24490

09/15/2022, 5:52 PM
I am getting this issue now. Adding NODE_ENV and JWT_SECRET didnt seem to help
message has been deleted
message has been deleted
message has been deleted
Anyone have any ideas. It was working until I added NODE_ENV and JWT_SECRET.
f

fresh-football-47124

09/15/2022, 5:56 PM
Can you go to the url of the API directly? If it's working, you should get a json object
e

enough-camera-24490

09/15/2022, 5:57 PM
I get a 502 error
f

fresh-football-47124

09/15/2022, 5:58 PM
That seems like the problem- if your running in docker, are their any errors in the console there?
e

enough-camera-24490

09/15/2022, 6:08 PM
I have an error in the logs about using JWT_secret=dev being not allowed.
But, I have set that in my docker-compose.yml file.
f

fresh-football-47124

09/15/2022, 6:08 PM
Sounds like it hasn't pulled in those changes
e

enough-camera-24490

09/15/2022, 6:10 PM
is
docker-compose restart growthbook
an appropriate way to get those updated?
f

fresh-football-47124

09/15/2022, 6:12 PM
@future-teacher-7046 do you know?
e

enough-camera-24490

09/15/2022, 6:16 PM
Looks like
Copy code
ENCRYPTION_KEY=<long-string>
Is required as well.
Alright, that should probably be somewhere in the docs. Its working again.
f

fresh-football-47124

09/15/2022, 6:20 PM
@proud-baker-47556 is that new?
Great! Glad you got it sorted
e

enough-camera-24490

09/15/2022, 6:20 PM
Still have the issue of multiple
Access-Control-Allow-Origin
rows.
I was hoping messing around with the ENV variables would resolve, but alas.
f

fresh-football-47124

09/15/2022, 6:21 PM
That's from the front end request?
e

enough-camera-24490

09/15/2022, 6:23 PM
Yes: Calling it from insomnia
<https://growthbook-api.fm.co/api/features/><key>
Also from react:
Copy code
useEffect(() => {
    // Load feature definitions from GrowthBook API
    fetch("<https://growthbook-api.fm.co/api/features/><key>")
message has been deleted
f

future-teacher-7046

09/15/2022, 6:37 PM
The API only sends a single access control header. Do you have nginx or another reverse proxy in front? It's possible that is adding a second one
🙌 1
22 Views