Issue
I'm seeing errors when attempting to use Sequelize in my node app.
Resolution
This is the required configuration:
const Sequelize = require('sequelize');
sequelize = new Sequelize(process.env.DATABASE_URL, {
dialectOptions: {
ssl: {
require: true,
rejectUnauthorized: false
}
}
}
);
sequelize
.authenticate()
.then(() => {
console.log('Connection has been established successfully.');
})
.catch(err => {
console.error('Unable to connect to the database:', err);
});