Question

Having trouble connecting Strapi to PostgreSQL dbaas

I’ve edited the config/database.js according to all the articles/tutorials I’m able to find, then I do the build, then try to start Strapi in dev mode and I get this error. Does this make sense to you?..

strapi build

Building your admin UI with development configuration …

✔ Webpack Compiled successfully in 2.34m

Admin UI built successfully root@nodejs12181onubuntu2004-s-1vcpu-1gb-intel-nyc1-01:/home/locohost/strapi# npm run develop

strapi@0.1.0 develop /home/locohost/strapi strapi develop

[2022-01-19 18:03:40.006] debug: ⛔️ Server wasn’t able to start properly. [2022-01-19 18:03:40.009] error: Unknown dialect undefined Error: Unknown dialect undefined at getDialectClass (/home/locohost/strapi/node_modules/@strapi/database/lib/dialects/index.js:12:13) at getDialect (/home/locohost/strapi/node_modules/@strapi/database/lib/dialects/index.js:19:23) at new Database (/home/locohost/strapi/node_modules/@strapi/database/lib/index.js:38:20) at Function.Database.init (/home/locohost/strapi/node_modules/@strapi/database/lib/index.js:84:33) at Strapi.bootstrap (/home/locohost/strapi/node_modules/@strapi/strapi/lib/Strapi.js:347:30) at Strapi.load (/home/locohost/strapi/node_modules/@strapi/strapi/lib/Strapi.js:410:16) at async Strapi.start (/home/locohost/strapi/node_modules/@strapi/strapi/lib/Strapi.js:161:9) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! strapi@0.1.0 develop: strapi develop npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the strapi@0.1.0 develop script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Subscribe
Share

Hers is my database.js…

module.exports = ({ env }) => ({
	defaultConnection: "default",
	connections: {
		default: {
			connector: "bookshelf",
			settings: {
				client: "postgres",
				host: env("DATABASE_HOST", "dbaas-db-7933374-do-user-810292-0.b.db.ondigitalocean.com"),
				port: env.int("DATABASE_PORT", 25060),
				database: env("DATABASE_NAME", "strapi"),
				username: env("DATABASE_USERNAME", "doadmin"),
				password: env("DATABASE_PASSWORD", "******"),
				schema: env("DATABASE_SCHEMA", "public"),
				ssl: env('DATABASE_SSL', false),
			},
			options: { debug: false },
		},
	},
});


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!