Stuck on " Waiting for your environment variables to be correctly set"

I’m trying to deploy en environment to production and I’m stuck to this message:
“Waiting for your environment variables to be correctly set. If this error persists, please check your server logs.”

I checked in the log and I can’t find any error
On the server side, everything seems to look fine.

Your application is listening on port 3310.
Your admin panel is available here:
GET /forest 204 - - 6.470 ms
GET /forest 204 - - 2.299 ms
GET /forest 204 - - 0.759 ms
GET /forest 204 - - 0.819 ms
GET /forest 204 - - 0.858 ms

Also, it looks like the API is correctly called but no data are returned.
It’s a fresh setup. It works locally but I can’t manage to deploy it in production.

  • Package Version: ^8.0.0
  • Express Version: 4.17.1
  • Sequelize Version:5.15.1
  • Database Dialect: PostgreSQL
  • Database Version: 9.6 (Google Cloud SQL)
  • Project Name: tns-stocks

I copied/pasted the .env file exactly as it is proposed in the “deploy to production” interface and checked that PostgreSQL is accessible through the pgsql command line.
Don’t know how to move forward…

Thanks for your help

Hi @nicolas_75,

Welcome to Forest.
What happened when the browser page is refreshed? Are you still stuck on the same page?
Also, how are the network calls from the browser side? Can you verify the http responses in the dev tool please?


Hi @Sliman_Medini ,

When the browser page is refreshed the same message appear again and I’m still stuck.
On the network tab in Chrome, I see a call to /forest every 10 seconds.
Here are the request headers:

GET /forest HTTP/1.1
Connection: keep-alive
sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"
Accept: application/json
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36
Content-Type: application/json
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,fr-FR;q=0.8,fr;q=0.7,it;q=0.6

And the response header:

HTTP/1.1 204 No Content
Server: nginx/1.14.0 (Ubuntu)
Date: Tue, 17 Aug 2021 14:46:02 GMT
Connection: keep-alive
X-Powered-By: Express
Vary: Origin
Access-Control-Allow-Credentials: true

The response is empty.

Hey @nicolas_75 :wave:

The HTTP GET /forest sending back a 204 is the normal behavior.

Could you send the last 4 characters of the FOREST_ENV_SECRET you are using in production? Could you also log process.env.FOREST_ENV_SECRET on your server startup (After require('dotenv');) just to make sure the variable used is actually the one provided on the “Deploy to production” flow ?
Did you restart your server once you updated the .env file?

On our end, your production environment is currently not configured, and the main reason of such issue would be an invalid/incorrect environment secret.

Let us know

1 Like

Here are the 4 last characters: 895b

And the secret key is corectly displayed when I restart the node process:

5|forest-a | ********895b
5|forest-a | Your application is listening on port 3310.
5|forest-a | GET /forest 404 145 - 5.408 ms
5|forest-a | Your admin panel is available here:
5|forest-a | GET /forest 204 - - 3.524 ms

I just realized the key displayed by the log is:
but the key in my .env file is ****7eef

The problem probably come from there. I’m trying to find why… The other vars in .env are correctly interpreted

Thanks @jeffladiray , I found the issue. The environment variables were set through bash and were overriding the .env file. I unset the bash variables and it works well.

1 Like