question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PGSSLMODE=no-verify is not equivalent to { ssl: { rejectUnauthorized: false } }

See original GitHub issue

My app only works with PGSSLMODE=no-verify and not { ssl: { rejectUnauthorized: false } }.

Otherwise it will err with: no pg_hba.conf entry for host....

Is this the expected behavior?

"pg": "^8.7.1",
"typeorm": "^0.2.37",
"@nestjs/typeorm": "^8.0.2"

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
aboqasemcommented, Feb 19, 2022

@sryze from docs:

postgresql://[userspec@][hostspec][/dbname][?paramspec]

Try adding ?sslmode=no-verify at the end of the URI, which is equivalent to the above.

const db = pgp(`${process.env.DATABASE_URL}${process.env.DATABASE_SECURE === 'true' ? '?sslmode=no-verify' : ''}`);
0reactions
sryzecommented, Feb 18, 2022

Nope, I’m actually using pg-promise

const pgp = require('pg-promise')();
const db = pgp(process.env.DATABASE_URL);

DATABASE_URL doesn’t contain any SSL parameters

Read more comments on GitHub >

github_iconTop Results From Across the Web

self signed certificate error · Issue #2009 · brianc/node-postgres
It'll default to rejectUnauthorized: false with the new major version. ... Client({ ssl: { rejectUnauthorized: false }}) // does NOT reject ...
Read more >
node.js - Is it ok to be setting rejectUnauthorized to false in ...
We recently moved to Heroku and upon attempting to connect our apps to the DB, it kept rejecting our queries with the message...
Read more >
tls - Is it safe to set rejectUnauthorized to false when using ...
Many StackOverflow questions with the same error say to set the variable rejectUnauthorized to false when making the http server. My question is ......
Read more >
Why am I getting an error when I upgrade to pg@8?
Setting up the ssl settings from Pool params. ... DATABASE_URL) config.ssl = { rejectUnauthorized: false } const pool = new Pool(config) ...
Read more >
How to Resolve Certificate Errors in a NodeJS App with SSL ...
The above SSL errors are thrown because the client is not able to verify the ... Quick and Dirty Fix: rejectUnauthorized ... rejectUnauthorized:...
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