-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promise { <pending> } #1130
Comments
Pool.query returns a promise. You will need to wait for it to fulfill before printing the result.
|
This is not 100% correct. query() returns a |
I'm having this same problem now. How do you get it to wait for the query to fill exactly? |
Either pass a callback as the last parameter to |
WHat @felixfbecker said. Either use a callback (and use a callback in signupsInactiveList), use Promises and return a promise, or use async/await. |
we added a new query in some existing code and now get an error:
// ---from model.js
var pg = require('pg');
var jwt = require('jsonwebtoken');
var bcrypt = require('bcrypt');
var Pool = require('pg').Pool;
var connectString = {user:"xxx", password:"xxx",
host:"localhost", database:"xxx"};
var pool = new Pool(connectString);
var exports = module.exports = {};
exports.signupsInactiveList = function() {
var data = pool.query("select * from signups");
return data;
}
// ---from test.js script:
var res = model.signupsInactiveList();
console.log(res);
all that is returned is the following:
Promise { }
since we are not specifying any promises, don't know where this is coming from except maybe in the node v6.5 or in the pg pooling - any ideas ?
The text was updated successfully, but these errors were encountered: