ISSUE: Deploy on Heroku

Hey :grinning: I am having problems deploying the admin backend on heroku. First i create the app in heroku following the steps here:

but when I want to enter the URL of the server I get this:

and heroku logs --tail

Then I found that I was missing the environment variables, so I followed the steps indicated here:

but I find the following:

What could be the cause of this, or what am I missing?
Should I add the .env variables e.g. APPLICATION_PORT=3310 and APPLICATION_URL=http://localhost:3310 in Config vars in Heroku? or something like this maybe i pass overhead.
I appreciate any help, comments. thank you!

Hi @usr1vang,

Visiting https://forest-admin-deploy-v2.herokuapp.com/ indicate the server is still not ok.
The heroku logs --tail logs screenshot shows the app is crashed, but we can’t see the first lines.
Something is making the app not starting.
If the same code is working locally, then it may be a configuration issue.

Can you run heroku logs --tail in a console, and then restart your application from another console? Like that you may this all the lines that are logged at server startup. You can restart with the command heroku restart --app application_name

You can find help about heroku crashed app here, here, here.

Regards

Here are the logs from start:

why could be all those errors?

Hi @usr1vang,

The Mongoose error displayed in the logs indicates the database connection url is undefined.
You can check in the config/databases.js file how is configured the database connection.
It should use the value process.env.DATABASE_URL.
It seems the environment variable DATABASE_URL is missing in heroku settings.

Regards

I have to add all this variables to heroku?

APPLICATION_PORT=3310
APPLICATION_URL=http://localhost:3310

CORS_ORIGINS=

DATABASE_URL=mongodb://localhost:27017/db_1
DATABASE_URL_2=mongodb://localhost:27017/db_2

DOCKER_DATABASE_URL=mongodb://host.docker.internal:27017/db_1
DATABASE_SSL=false
This should be removed in production environment.
DATABASE_REJECT_UNAUTHORIZED=false

FOREST_AUTH_SECRET=*******
FOREST_ENV_SECRET=*****

Hello,

Yes because your server need to be configured so it must have the variables defined with correct values.

Take care to not mix the variables with other environments (for example the FOREST_ENV_SECRET is different from one environment to another)

Regards