Stuck at the final configuration step

Hi there,

[Newbie question] I’m new to Forest Admin - it looks like a great tool!

I’m currently at the last configuration step: Set your environment variables.

I added all of the requested env variables through the Heroku interface - double checked twice if everything was correct.

Currently my url https://spokebase.herokuapp.com/ returns " Your application is running!" which is great… but I’m still faced with the following error from forest:

Waiting for your environment variables to be correctly set. If this error persists, please check your server logs.

What am I doing wrong? Any idea what I should do?
Thanks in advance for all the help!

Hi @philip,

Thanks you for your interest in Forest.
This means the first good thing: Forest was able to connect to your app.
But, your server did not send back the good values to be identified.

What is your project name?
What installation step did you follow?
Can you please share your server logs?

Regards

I created a new project from scratch and deleted the old one. I’m now capable of completing the configuration, but i have a new porblem:

2021-07-12T08:53:54.945728+00:00 app[web.1]: [forest] :deciduous_tree::deciduous_tree::deciduous_tree: Unexpected error: no pg_hba.conf entry for host “54.87.26.232”, user “lydkxweofjxeqh”, database “d4ee5esqnnv15k”, SSL off

Any idea how to solve it?

Ok,

Can you please share the entire log, and also provide all the possible details about your stack, etc.

Regards

2021-07-12T08:53:54.941858+00:00 app[web.1]: [forest] :deciduous_tree::deciduous_tree::deciduous_tree: Unexpected error: no pg_hba.conf entry for host “54.87.26.232”, user “lydkxweofjxeqh”, database “d4ee5esqnnv15k”, SSL off
2021-07-12T08:53:54.941892+00:00 app[web.1]: {
2021-07-12T08:53:54.941893+00:00 app[web.1]: “name”: “SequelizeConnectionError”,
2021-07-12T08:53:54.941893+00:00 app[web.1]: “parent”: {
2021-07-12T08:53:54.941894+00:00 app[web.1]: “length”: 166,
2021-07-12T08:53:54.941894+00:00 app[web.1]: “name”: “error”,
2021-07-12T08:53:54.941894+00:00 app[web.1]: “severity”: “FATAL”,
2021-07-12T08:53:54.941895+00:00 app[web.1]: “code”: “28000”,
2021-07-12T08:53:54.941895+00:00 app[web.1]: “file”: “auth.c”,
2021-07-12T08:53:54.941896+00:00 app[web.1]: “line”: “496”,
2021-07-12T08:53:54.941896+00:00 app[web.1]: “routine”: “ClientAuthentication”
2021-07-12T08:53:54.941896+00:00 app[web.1]: },
2021-07-12T08:53:54.941897+00:00 app[web.1]: “original”: {
2021-07-12T08:53:54.941897+00:00 app[web.1]: “length”: 166,
2021-07-12T08:53:54.941898+00:00 app[web.1]: “name”: “error”,
2021-07-12T08:53:54.941898+00:00 app[web.1]: “severity”: “FATAL”,
2021-07-12T08:53:54.941898+00:00 app[web.1]: “code”: “28000”,
2021-07-12T08:53:54.941899+00:00 app[web.1]: “file”: “auth.c”,
2021-07-12T08:53:54.941899+00:00 app[web.1]: “line”: “496”,
2021-07-12T08:53:54.941899+00:00 app[web.1]: “routine”: “ClientAuthentication”
2021-07-12T08:53:54.941900+00:00 app[web.1]: },
2021-07-12T08:53:54.941902+00:00 app[web.1]: “stack”: “SequelizeConnectionError: no pg_hba.conf entry for host “54.87.26.232”, user “lydkxweofjxeqh”, database “d4ee5esqnnv15k”, SSL off\n at /app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:182:24\n at Connection.connectingErrorHandler (/app/node_modules/pg/lib/client.js:213:14)\n at Connection.emit (events.js:375:28)\n at /app/node_modules/pg/lib/connection.js:109:10\n at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:40:17)\n at Socket. (/app/node_modules/pg-protocol/dist/index.js:11:42)\n at Socket.emit (events.js:375:28)\n at addChunk (internal/streams/readable.js:290:12)\n at readableAddChunk (internal/streams/readable.js:265:9)\n at Socket.Readable.push (internal/streams/readable.js:204:10)\n at TCP.onStreamRead (internal/stream_base_commons.js:188:23)”
2021-07-12T08:53:54.941902+00:00 app[web.1]: }
2021-07-12T08:53:54.944244+00:00 app[web.1]: GET /forest/businessHours?timezone=Europe%2FBerlin&fields%5BbusinessHours%5D=createdAt%2Cday%2CfulfilmentLocation%2Cid%2CupdatedAt&fields%5BfulfilmentLocation%5D=name&page%5Bnumber%5D=1&page%5Bsize%5D=15&searchExtended=0&sort=-id 500 182 - 388.084 ms
2021-07-12T08:53:54.945728+00:00 app[web.1]: [forest] :deciduous_tree::deciduous_tree::deciduous_tree: Unexpected error: no pg_hba.conf entry for host “54.87.26.232”, user “lydkxweofjxeqh”, database “d4ee5esqnnv15k”, SSL off
2021-07-12T08:53:54.945729+00:00 app[web.1]: {
2021-07-12T08:53:54.945730+00:00 app[web.1]: “name”: “SequelizeConnectionError”,
2021-07-12T08:53:54.945730+00:00 app[web.1]: “parent”: {
2021-07-12T08:53:54.945730+00:00 app[web.1]: “length”: 166,
2021-07-12T08:53:54.945731+00:00 app[web.1]: “name”: “error”,
2021-07-12T08:53:54.945731+00:00 app[web.1]: “severity”: “FATAL”,
2021-07-12T08:53:54.945731+00:00 app[web.1]: “code”: “28000”,
2021-07-12T08:53:54.945732+00:00 app[web.1]: “file”: “auth.c”,
2021-07-12T08:53:54.945732+00:00 app[web.1]: “line”: “496”,
2021-07-12T08:53:54.945732+00:00 app[web.1]: “routine”: “ClientAuthentication”
2021-07-12T08:53:54.945733+00:00 app[web.1]: },
2021-07-12T08:53:54.945733+00:00 app[web.1]: “original”: {
2021-07-12T08:53:54.945733+00:00 app[web.1]: “length”: 166,
2021-07-12T08:53:54.945734+00:00 app[web.1]: “name”: “error”,
2021-07-12T08:53:54.945734+00:00 app[web.1]: “severity”: “FATAL”,
2021-07-12T08:53:54.945735+00:00 app[web.1]: “code”: “28000”,
2021-07-12T08:53:54.945735+00:00 app[web.1]: “file”: “auth.c”,
2021-07-12T08:53:54.945736+00:00 app[web.1]: “line”: “496”,
2021-07-12T08:53:54.945736+00:00 app[web.1]: “routine”: “ClientAuthentication”
2021-07-12T08:53:54.945736+00:00 app[web.1]: },
2021-07-12T08:53:54.945738+00:00 app[web.1]: “stack”: “SequelizeConnectionError: no pg_hba.conf entry for host “54.87.26.232”, user “lydkxweofjxeqh”, database “d4ee5esqnnv15k”, SSL off\n at /app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:182:24\n at Connection.connectingErrorHandler (/app/node_modules/pg/lib/client.js:213:14)\n at Connection.emit (events.js:375:28)\n at /app/node_modules/pg/lib/connection.js:109:10\n at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:40:17)\n at Socket. (/app/node_modules/pg-protocol/dist/index.js:11:42)\n at Socket.emit (events.js:375:28)\n at addChunk (internal/streams/readable.js:290:12)\n at readableAddChunk (internal/streams/readable.js:265:9)\n at Socket.Readable.push (internal/streams/readable.js:204:10)\n at TCP.onStreamRead (internal/stream_base_commons.js:188:23)”
2021-07-12T08:53:54.945738+00:00 app[web.1]: }

I’m using Heroku / Postgres. I configured the tables through Hasura

It’s an issue in database connection configuration.
Did you succeed to connect to this database with a regular client with the same credentials?

Regards

I can connect fine with SQLPro for Postgres with the same credentials

Hi @Sliman_Medini,

First of all: thank you for helping me :slight_smile: I really appreciate it.

I found an previous post about a similar issue: Struggling to set up Forest with my Heroku-deployed Postgres DB

Do you think it’s related? I checked in config > databases.js and the code seems to already be correct:

if (process.env.DATABASE_SSL && JSON.parse(process.env.DATABASE_SSL.toLowerCase())) {
const rejectUnauthorized = process.env.DATABASE_REJECT_UNAUTHORIZED;
if (rejectUnauthorized && (JSON.parse(rejectUnauthorized.toLowerCase()) === false)) {
databaseOptions.dialectOptions.ssl = { rejectUnauthorized: false };
} else {
databaseOptions.dialectOptions.ssl = true;
}
}

Hi @philip,

Did you have a try with DATABASE_REJECT_UNAUTHORIZED=false ?

Regards

Just tried, same problem unfortunately. :confused:

@Sliman_Medini,

do you have any ideas I should try? Do you think it makes sense to again try to set up everything from scratch?

Thanks for your help
Philip

Hi @philip,

Do you have DATABASE_SSL=true in conjunction with DATABASE_REJECT_UNAUTHORIZED=false ?

const path = require('path');

const databaseOptions = {
  logging: !process.env.NODE_ENV || process.env.NODE_ENV === 'development' ? console.log : false,
  pool: { maxConnections: 10, minConnections: 1 },
  dialectOptions: {},
};

if (process.env.DATABASE_SSL=true && JSON.parse(process.env.DATABASE_SSL.toLowerCase())) {
  const rejectUnauthorized = process.env.DATABASE_REJECT_UNAUTHORIZED=false;
  if (rejectUnauthorized && (JSON.parse(rejectUnauthorized.toLowerCase()) === false)) {
    databaseOptions.dialectOptions.ssl = { rejectUnauthorized: false };
  } else {
    databaseOptions.dialectOptions.ssl = true;
  }
}

module.exports = [{
  name: 'default',
  modelsDir: path.resolve(__dirname, '../models'),
  connection: {
    url: process.env.DATABASE_URL,
    options: { ...databaseOptions },
  },
}];

You mean like this? If I add =true, the app crashes

There is no need to change the code, you can just add this to your .env file:

DATABASE_SSL=true
DATABASE_REJECT_UNAUTHORIZED=false
1 Like

It works! Merci beaucoup @Sliman_Medini !
Have a great day.

1 Like