[Fixed] SequelizeConnectionError: The server does not support SSL connections

Issue

I am trying to connect my project with PostgreSQL but show this error. Please help me
I have installed Postgres.app and for GUI PgAdmin.

Unhandled rejection SequelizeConnectionError: The server does not support SSL connections
        at /Users/inamur/Documents/Project/project-api/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:186:20
        at Connection.connectingErrorHandler (/Users/inamur/Documents/Project/project-api/node_modules/pg/lib/client.js:203:14)
        at Connection.emit (events.js:223:5)
        at Connection.EventEmitter.emit (domain.js:475:20)
        at Socket.<anonymous> (/Users/inamur/Documents/Project/project-api/node_modules/pg/lib/connection.js:90:21)
        at Object.onceWrapper (events.js:313:26)
        at Socket.emit (events.js:223:5)
        at Socket.EventEmitter.emit (domain.js:475:20)
        at addChunk (_stream_readable.js:309:12)
        at readableAddChunk (_stream_readable.js:290:11)
        at Socket.Readable.push (_stream_readable.js:224:10)
        at TCP.onStreamRead (internal/stream_base_commons.js:181:23)

This is my .env file

JWT_SECRET='UserNews'
DB_LINK='postgres://root:[email protected]:5432/SCROLL001?ssl=true'

This is connection file.

const sequelize = new Sequelize(process.env.DB_LINK, {
  dialect: 'postgres',
  protocol: 'postgres',
  dialectOptions: {
    ssl: {
      require: 'true'
    }
  }
});

Solution

I have solved the issue.

const sequelize = new Sequelize(process.env.DB_LINK, {
  dialect: 'postgres',
  protocol: 'postgres',
  dialectOptions: {}, //removed ssl
});

Change the DB Link

DB_LINK='postgres://root:[email protected]:5432/SCROLL001'

Leave a Reply

(*) Required, Your email will not be published