I am trying to connect a custom database to auth0 and am using their default Postgres script.
I can’t figure out why I am getting the following error:
this._connectionCallback is not a function
connectionCallback doesn’t exist in the snippet. Here’s the ‘verify’ snippet:
function verify (email, callback) {
//this example uses the "pg" library
const { Client } = require("pg");
const conString = new
Client({connectionString:'postgresql://postgres:password@database:port/host'});
conString.connect(conString, function (err, client, done) {
if (err) return callback(err);
const query = 'UPDATE auth_user SET email_Verified = true WHERE email_Verified = false AND email = $1';
client.query(query, [email], function (err, result) {
done();
return callback(err, result && result.rowCount > 0);
});
});
}
Appreciate any help with this.
2
Answers
I found the solution in this thread - pg.connect not a function?
Basically, pg.connect has been hard-deprecated in favor of pg.Pool, as documented here: https://node-postgres.com/guides/upgrading
So the functional code now looks like this:
for test check this code