node-postgres: Regression in 7.18.0 causing "unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0"

I don’t use pg directly but through sequelize (ORM). Updating to 7.17.0 works fine. 7.17.1 works fine, but the same unchanged code with pg 7.18.0 will throw an exception on connection:

unsupported frontend protocol 1234.5679: server supports 2.0 to 3.0

I don’t have the full exception atm but this bit:

at Connection.connectingErrorHandler (C:\Users\jant\Repos\get-coffee\packages\get-coffee-api\node_modules\pg\lib\client.js:194:14)
    at Connection.emit (events.js:210:5)
    at Connection.EventEmitter.emit (domain.js:476:20)
    at TLSSocket.<anonymous> (C:\Users\jant\Repos\get-coffee\packages\get-coffee-api\node_modules\pg\lib\connection.js:144:12)
    at TLSSocket.emit (events.js:210:5)
    at TLSSocket.EventEmitter.emit (domain.js:476:20)
    at addChunk (_stream_readable.js:308:12)
    at readableAddChunk (_stream_readable.js:289:11)
    at TLSSocket.Readable.push (_stream_readable.js:223:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:182:23)

Why do I believe this is a regression: After downgrading to 7.17.1, connection works fine. After upgrading to 7.18.0, it breaks again.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 10
  • Comments: 18 (11 by maintainers)

Commits related to this issue

Most upvoted comments

alrighty everyone…published pg@7.18.1

sorry again for the disruption! Please don’t hesitate to open another issue if there’s something amiss. I’ll be watching for the next several hours at least. ❤️

found the problem, and tested a fix. figuring out a unit test for it & will push a new patch version w/ the fix. my deep apologies!

Related changes: https://github.com/brianc/node-postgres/pull/2082/files#diff-1449b1bce007eeb37fb3f3077d2dd1cbR120-R125 (from PR https://github.com/brianc/node-postgres/pull/2082) If those lines are commented out, connections work again. Related PG code (80877103 which translates to `1234. 5679) is explained at https://www.postgresql.org/docs/12/protocol-message-formats.html

/paging @charmander and @brianc as this breaks v7.18 for TLS-enabled connections 🙏

ah crap! What version of postgres are y’all using?