node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

Fix 'Error: invalid sslmode value: "true"' in native mode

Open sundbry opened this issue 4 years ago • 4 comments

When using PGSSLMODE env in native mode, an invalid database URL string is constructed with sslmode=true/false.

sundbry avatar Jul 31 '20 22:07 sundbry

Hey thanks for this! Is there a way to write a test for this? If not, if you could show an example in code that causes the problem I can write a test to exercise the fix. Either way I'm good - but need to get this under test so we don't regress on it! 😄

brianc avatar Aug 03 '20 13:08 brianc

Hello, please merge and release this. This is important. It is necessary to have this merged.

[Error: invalid sslmode value: "true"
]

@sundbry thank you for the fix!

Andrei-Stepanov avatar Jan 05 '22 15:01 Andrei-Stepanov

This bug is present in "pg": "^8.7.1",

Andrei-Stepanov avatar Jan 05 '22 15:01 Andrei-Stepanov

@Andrei-Stepanov There’s still no test. What configuration causes this error?

charmander avatar Jan 07 '22 00:01 charmander

@charmander : configuration/testcase scenario:

  1. Have a postgresql-server without SSL transport.
  2. Try to connect to this server using pg module enforcing/requiring SSL transport with env variable: PGSSLMODE=require.

Connection should not be established, but it is estalished. pg overrides this parameter.

Related docs: https://www.postgresql.org/docs/current/libpq-envars.html https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLMODE

Andrei-Stepanov avatar Nov 07 '22 21:11 Andrei-Stepanov

@Andrei-Stepanov Which is it? Connection is established when it should not be, or Error: invalid sslmode value: "true"?

charmander avatar Nov 08 '22 00:11 charmander

I think this: Connection is established when it should not be.

Andrei-Stepanov avatar Nov 08 '22 00:11 Andrei-Stepanov

@Andrei-Stepanov That sounds like an issue separate from what this PR claims to address (and what I was requesting a test case for), then. Please open an issue for it.

charmander avatar Nov 08 '22 00:11 charmander