brianc/node-postgres — Issue #88: expected terminator at last byte error on node 0.6.6
Author: pvencill
Created: 2012-01-19 20:18:15+00:00
State: open

I know this came up in previous versions of node, and it was patched, but I'm getting this error trying to do a parameterized insert:

STATEMENT: INSERT INTO web_user_sessions (sid, session, expires) values ($1,$2,$3)
LOG: execute : INSERT INTO web_user_sessions (sid, session, expires) values ($1,$2,$3)
DETAIL: parameters: $1 = '{hashed_session_id_extracted', $2 = '{"lastAccess":1327000512568,"cookie":{"originalMaxAge":14400000,"expires":"2012-01-19T23:15:12.573Z","httpOnly":true,"path":"/"}}', $3 = '2012-01-19 23:15:12.573'
LOG: connection received: host=127.0.0.1 port=49057
FATAL: invalid startup packet layout: expected terminator as last byte
LOG: unexpected EOF on client connection

The problem is occurring on Ubuntu 10.10 running postgres 9.1, node 0.6.6 and pg v0.6.9

I looked in writer.js and it looks like the pg source is updated with the described null terminator patch. It may also be significant that the same node app works fine locally in my dev box (running Mac OSX Lion, postgres 9.0.4, node 0.6.6 and pg v0.6.9) as well as on Heroku (but I know they're running node 0.4.7)