brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
112 stars 42 forks source link

Both connect() and connectSync() return undefined value on 'success' on latest Node.js #47

Open sjuvonen opened 7 years ago

sjuvonen commented 7 years ago

I am not able to create connections using Node 6.7.0 and libpq 1.8.5. Both connect() and connectSync() have no return value when the connection is successful (on libpq's side). Passing invalid parameters to the functions will result in an error and the error object is passed to my code as it should, but otherwise there is no value passed.

let Libpq = require("libpq");
let pq = new Libpq;

pq.connect("postgresql://localhost/mydb", (...args) => {
  console.log(args.length); // outputs '0'
});

let client = pq.connectSync("postgresql://localhost/mydb");
console.log(client); // outputs 'undefined'