Skip to content

Cannot use ssl: 'require' #2659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timja opened this issue Nov 22, 2021 · 3 comments
Closed

Cannot use ssl: 'require' #2659

timja opened this issue Nov 22, 2021 · 3 comments

Comments

@timja
Copy link

timja commented Nov 22, 2021

See #2406 (comment)

(this used to work)

/usr/src/app/node_modules/pg/lib/connection.js:85
        if ('key' in self.ssl) {
                  ^

TypeError: Cannot use 'in' operator to search for 'key' in require
    at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:85:19)
    at Object.onceWrapper (events.js:520:26)
    at Socket.emit (events.js:400:28)
    at Socket.emit (domain.js:475:12)
    at addChunk (internal/streams/readable.js:293:12)
    at readableAddChunk (internal/streams/readable.js:267:9)
    at Socket.Readable.push (internal/streams/readable.js:206:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)

Workaround: Set PGSSLMODE environment variable from https://github.com/brianc/node-postgres/blob/master/CHANGELOG.md#pg810

@charmander
Copy link
Collaborator

(this used to work)

It used to not throw an error, but the ssl config option has never taken a string value. You should write ssl: true for that behaviour.

@timja
Copy link
Author

timja commented Nov 22, 2021

It used to work at some point, (unless you mean it converted it to ssl: true)

@charmander
Copy link
Collaborator

Yep, that’s what I mean. It was a truthy value interpreted as ssl: true; it didn’t use the PGSSLMODE mapping.

@timja timja closed this as completed Nov 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants