Node-postgres: Failing at connection after running npm install

Created on 4 May 2018  ·  17Comments  ·  Source: brianc/node-postgres

I have a piece of code that connects to Redshift and runs a query. The code worked until I re-deployed today without changing anything in the functionality or the npm version. Note that every time I deploy the code, it installs all the npm packages before archiving.

In package.json I have "pg": "^7.4.1" as the dependency.

The error I am constantly getting is:

AssertionError: false == true
at Object.exports.connect (_tls_wrap.js:1020:3)
at Socket.<anonymous> (/var/task/node_modules/pg/lib/connection.js:94:23)
at Socket.g (events.js:292:16)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:547:20)

Anyone have a clue on what is causing this? Thanks!

bug

Most helpful comment

The issue is fixed wit the commit 7de137f9f88611b8fcae5539aa90b6037133f1f1.
Thank you @matthiasak.

All 17 comments

I had this exact issue as well. It took our site down in production as we spun up new servers because the ^ character in your package.json means to load in the most recent minor version package, and since 7.4.2 is new as of 4 hrs ago it loaded that package in. I had to remove the ^ from my dependency so that it would lock in the previous version.

Edit: If someone with more knowledge than me things this is an pretty easy fix, let me know and I'll take a crack at trying to fix it.

@vitaly-t Note, that this issue appears to also impact [email protected]

@vladpap31 Please tells us what versions of Node.js and PostgreSQL are you using.

Encountered the same issue 5 minutes ago.

Node: v10,
Postgres: 10.3

@larsthorup Thank you for pinging me on this. I have reverted pg-promise in version 8.4.2 to the previous version of the driver.

I am using Node 6.10 and the database is Amazon Redshift which is based off of PostgreSQL 8.0.2

Ok, so it is fair to say at this point that the issue is irrelevant of the Node.js or PostgreSQL versions. It was a generic-type break in connectivity, caused by one of these commits:

1638

I also ran into this Node 8.11.1

Same result here since yesterday : Node 8.11.1, postgresql 9.4.6.
I'm using the lib through https://github.com/strongloop/loopback-connector-postgresql which use "pg": "^7.0.0"
To make my projects works again, i temporary set the pg version to "7.4.1" in my package-lock.json for the loopback-connector-postgresql
then i installed "pg-types"

did some sleuthing before I even saw this thread - fix here #1638

had to roll back to [email protected]

For anyone needing to move forward, rolling back to 7.4.1 should work.

I had the same issue for anything >7

Gotcha. Might be an different root cause then 🦍

On Sun, May 6, 2018, 9:01 PM Eli Tabello notifications@github.com wrote:

I had the same issue for anything >7


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/brianc/node-postgres/issues/1636#issuecomment-386937209,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA2-p9d-JCyZl2m0iVLvkxzSaSFMzqfEks5tv6rpgaJpZM4TzURX
.

>

Cheers,

Matthew Keas

@openciti

I had the same issue for anything >7

Not possible, unless you include it as: "pg": "^7.0.0", or didn't re-install it properly after updating in package.json.

The issue is fixed wit the commit 7de137f9f88611b8fcae5539aa90b6037133f1f1.
Thank you @matthiasak.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisjensen picture chrisjensen  ·  4Comments

gajus picture gajus  ·  4Comments

wrod7 picture wrod7  ·  4Comments

gregallenvt picture gregallenvt  ·  3Comments

joaquimknox picture joaquimknox  ·  3Comments