SequelizeConnectionError: self signed certificate

See original GitHub issue

Issue Description

I’m getting the exception quoted in the title when trying to connect to a postgres db on heroku and I’m getting the above error. The code I am trying:

    let conString = 'postgres://senmqzvgnanlse:5493b61d735244b7662c26a49f3e55deb1699df937df66d3479f2343a69f20d1@ec2-54-197-48-79.compute-1.amazonaws.com:5432/duv1dtt8gctq9?ssl=true';
    let seq = new Sequelize(conString);
    await seq.authenticate();

Note that this is a dev db so I’m not bothered about leaving the connection details here. What on earth does that error mean ? I presume it’s coming back from Heroku.

Additional context

Using version the following versions:

"pg": "^8.0.0",
"pg-hstore": "^2.3.3"
"sequelize": "^5.21.6"

Issue Template Checklist

Is this issue dialect-specific?

  • No. This issue is relevant to Sequelize as a whole.
  • [X ] Yes. This issue only applies to the following dialect(s): PostGres
  • I don’t know.

Would you be willing to resolve this issue by submitting a Pull Request?

  • [X ] Yes, I have the time and I know how to start.
  • Yes, I have the time but I don’t know how to start, I would need guidance.
  • No, I don’t have the time, although I believe I could do it if I had the time…
  • No, I don’t have the time and I wouldn’t even know how to start.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

80reactions
manoellribeirocommented, Sep 18, 2020

CherryDT answer helped me with this issue:

dialectOptions: {
            ssl: {
                require: true,
                rejectUnauthorized: false
            }
        }

It worked for me using sequelize 5.21.11 and pg 8.2.1

8reactions
Mars079commented, Apr 15, 2020

This is a problem that i faced not only with sequelize, but also with knex. The real problem is with the PG module, from the version 8+ this problem had been happening. I installed the version 7.12.0 and the connection worked fine with both sequelize/knex.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SequelizeConnectionError: self signed certificate
It happens because you use uri parameter for defining the connection, not the pg object parameter. PostgreSQL accepts several values for the ...
Read more >
self signed certificate in certificate chain" when upgrading
Currently, I am deploying self-hosted retool on ECS based on ... "SequelizeConnectionError: self signed certificate in certificate chain" ...
Read more >
SequelizeConnectionError: self signed certificate-postgresql
The solution is to pass rejectUnauthorized: false to the sequelize connection parameters inside of dialectOptions > ssl , as described here by GitHub...
Read more >
Getting rid of PostgreSQL SSL certificate errors - Support
to show where the warning was created) Unhandled rejection SequelizeConnectionError: self signed certificate in certificate chain at Client.
Read more >
Javascript – SequelizeConnectionError: self signed certificate
Javascript – SequelizeConnectionError: self signed certificate. backendexpressjavascriptpostgresql. I am trying to connect to a PostgreSQL Database that ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found