Description
First off, thanks for the library! Overall it's been incredibly performant and straightforward to use. I am running into one issue which may be an issue with the library, though it's a bit hard to follow the protocol for me so my usage may be off as well.
I'm running into an uncaught error during the parseComplete
handler in client.js (https://github.com/brianc/node-postgres/blob/v6.0.1/lib/client.js#L131).
I am doing a direct connect
against the pool and then utilizing pg-query-stream
pool.connect().then(function(client){
stream = client.query(new QueryStream(query, null));
stream.on('error', function(streamError){
stream.close(function(closeError){
// What to do with a close error? At this point stream is already hosed :shrug:
client.release(streamError);
}
});
stream.on('close', function(){
client.release();
});
});
At some point during my app's life cycle, I get an uncaught error
TypeError: Cannot read property 'name' of null
at null.<anonymous> (/var/app/current/node_modules/pg/lib/client.js:139:26)
at emit (events.js:107:17)
at Socket.<anonymous> (/var/app/current/node_modules/pg/lib/connection.js:121:12)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:540:20)
So obviously activeQuery
is becoming null, and I am trying to narrow down why I would receive a parseComplete
event when the active query is null.
According to my logs, the stream is not emitting an error, and seems to be closing normally. Therefore it seems like the connection client is getting a readyForQuery
or end
event, and then right after that getting the parseComplete
event. Any idea why this would be happening, or see any issues with my usage? Thanks for any help you can give! I'll keep looking into it as well.