Error creating a connection to Postgresql while preparing konga database

After installing Konga, we are trying to prepare Konga database on the already running Postgresql database. by using suggested command i.e.

node ./bin/konga.js prepare --adapter postgres --uri postgresql://localhost:5432/konga

But we are facing the error as below:

Error creating a connection to Postgresql using the following settings:
 postgresql://localhost:5432/konga?host=localhost&port=5432&schema=true&ssl=false&adapter=sails-postgresql&user=postgres&password=XXXX&database=konga_database&identity=postgres

* * *
Complete error details:
 error: password authentication failed for user "root"
error: A hook (`orm`) failed to load!
error: Failed to prepare database: error: password authentication failed for user "root"

We even created the schema konga_database manually and have tried several variations for prepare command but no fate

node ./bin/konga.js  prepare --adapter postgres --uri postgresql://kong:XXXX@localhost:5432/konga_database
node ./bin/konga.js  prepare --adapter postgres --uri postgresql://kong@localhost:5432/konga
node ./bin/konga.js  prepare --adapter postgres --uri postgresql://kong@localhost:5432/konga_database

Below is config/connections.js

  postgres: {
    adapter: 'sails-postgresql',
    url: process.env.DB_URI,
    host: process.env.DB_HOST || 'localhost',
    user:  process.env.DB_USER || 'postgres',
    password: process.env.DB_PASSWORD || 'XXXX',
    port: process.env.DB_PORT || 5432,
    database: process.env.DB_DATABASE ||'konga_database',
    // schema: process.env.DB_PG_SCHEMA ||'public',
    // poolSize: process.env.DB_POOLSIZE || 10,
    ssl: process.env.DB_SSL ? true : false // If set, assume it's true
  },

Below is .env file configuration

PORT=1337
NODE_ENV=production
KONGA_HOOK_TIMEOUT=120000
DB_ADAPTER=postgres
DB_URI=postgresql://localhost:5432/konga
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASSWORD=XXXX
KONGA_LOG_LEVEL=info
TOKEN_SECRET=

kong and postgresql are already running on the AWS linux AMI 2 server on there respective ports i.e. 8443 & 5432

Please help us to prepare DB and start konga service. Also. let us know in case you need more info.

Node v: v12.19.0
NPM v: 6.14.8

Regards Nitin G


Maybe I overlooked it, but what version of PostreSQL are you using?

Konga is not able to support postgresql 12:

https://github.com/pantsel/konga/issues/487