The code I was using while I got this error was:
sequelize = new Sequelize(process.env.DATABASE_URL);
Now, Heroku requires SSL to be enabled according to this quote from Heroku's Help Site
The authentication failed because the connection didn't use SSL encryption: (SSL off). All Heroku Postgres production databases require using SSL connections to ensure that communications between applications and the database remain secure. If your client is not using SSL to connect to your database, you would see these errors even if you're using the right credentials to connect to it.
My code changed accordingly to solve the error and now looks like this:
sequelize = new Sequelize(process.env.DATABASE_URL, {
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false,
},
},
});
Top comments (0)