Pg-promise: ERROR TypeError: Cannot read property 'options' of undefined

Created on 8 Sep 2017  路  18Comments  路  Source: vitaly-t/pg-promise

I got errors like logs below.
I see it's my failure that conections are over limit.
The issue is next to the error.

I'm not sure but it should be cnOptions instead of options ?

(snip)
{ error: remaining connection slots are reserved for non-replication superuser connections
   at Connection.parseE (/usr/src/app/node_modules/pg/lib/connection.js:567:11)
   at Connection.parseMessage (/usr/src/app/node_modules/pg/lib/connection.js:391:17)
   at TLSSocket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:129:22)
   at emitOne (events.js:96:13)
   at TLSSocket.emit (events.js:191:7)
   at readableAddChunk (_stream_readable.js:178:18)
   at TLSSocket.Readable.push (_stream_readable.js:136:10)
   at TLSWrap.onread (net.js:561:20)
(snip)
 [Fri Sep 08 2017 01:44:03 GMT+0000 (UTC)] ERROR TypeError: Cannot read property 'options' of undefined
   at BoundPool.onError (/usr/src/app/node_modules/pg-promise/lib/database.js:1320:25)
   at emitTwo (events.js:106:13)
   at BoundPool.emit (events.js:194:7)
(snip)
duplicate question

All 18 comments

Duplicate of #354

You should upgrade to the latest version ;)

Hmm... I'm using v6.3.8 newer than v5.9.5 (described on #354).
Surely it is older than the newest. I'm going to upgrade it.

I got same errors even tough I upgraded it to [email protected].

An additional issue possibly related this.

As you know, the default pool size on node-postgres is 10.
My PostgreSQL instance (actually on AzureDB) is assigned 50 connects.
It shouldn't be exhausted all connections if there is no bugs.

Just guess but I suspect there have some inconsistency between pg-pool and pg-promise...

@cryptcoin-junkey can you come up with a usable reproducible example?

Then I would be able to have a look at it.

@cryptcoin-junkey Update v6.5.2 includes the change, though I will be surprised if it makes a difference.

Could you come back on this one, please!

Thank you for your quick response. I tried 6.5.2. But it seems no effect.
I'll inspect it deeper today.

@cryptcoin-junkey it contained the change you were looking for.

Looks you are gonna need to come up with a usable example that reproduces the issue. Otherwise I wouldn't even know where to look at.

I found this : https://github.com/brianc/node-postgres/issues/1344
It looks node-postgres has some issues on using with AzureDB.
(also #354 was on AzureDB.)

I close this since there is less sense to analysis in situations where there have bugs in the dependent library.
I'll recheck this issue after brianc/node-postgres#1334 was resolved.

Thank you for your kind support.

Issue brianc/node-postgres#1334 was merged there on June 20, and it is included into v6.4.2 that's used by this library.

My mistake. Not brianc/node-postgres#1334 but brianc/node-postgres#1344.

upgrade to 6.5.2 doesnt fix the issue. any final solution for this issue?

@ubreddy as per the message above, you should follow this issue: https://github.com/brianc/node-postgres/issues/1344

From what I can see, it is still not resolved within the driver.

@vitaly-t
the driver is still not updated.. There is a pull request pending.
meanwhile to avoid this crash is there a workaround?

@ubreddy not that I know of, sorry.

making the pg point to this version resolves the issue..
"pg": "pasieronen/node-postgres#ssl-close-econnreset",
this pull request is pending.

@vitaly-t can you update the dependency to 7.4.1 ? the driver is updated with the pull request.

@ubreddy Current dependency is set as "pg": "~7.4.0", which means it will install driver 7.4.1, if you re-install the dependencies :wink:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

realcarbonneau picture realcarbonneau  路  4Comments

Fte-github picture Fte-github  路  4Comments

paleite picture paleite  路  4Comments

msjoshi picture msjoshi  路  4Comments

Juanflugel picture Juanflugel  路  3Comments