Skip to content

Uncaught exception: TypeError: Cannot call method 'startStreamingToConnection' of undefined #241

@strk

Description

@strk

This is happening with 0.11.0:

strk.localhost> copy test from stdin;

/home/src/node/modules/node-postgres/lib/query.js:173
  this.stream.startStreamingToConnection(connection);
              ^
TypeError: Cannot call method 'startStreamingToConnection' of undefined
    at p.streamData (/home/src/node/modules/node-postgres/lib/query.js:173:15)
    at p.connect.con.once.callback (/home/src/node/modules/node-postgres/lib/client.js:109:24)
    at EventEmitter.emit (events.js:93:17)
    at Socket.p.attachListeners (/home/src/node/modules/node-postgres/lib/connection.js:86:12)
    at Socket.EventEmitter.emit (events.js:93:17)
    at TCP.onread (net.js:396:14)

The calling code goes like this:

var pg = require('pg');
pg.connect('tcp://strk@localhost:5432/strk', function(err, c) 
{ 
  console.log('connected');
  c.query('COPY test FROM stdin;', function(e,r) {
    console.log('SURVIVED, error is: ' + e); // never gets here
  });
});

Expected behavior: the callback function is invoked, passing the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions