Reputation: 6976
I'm getting below warning error, please guide me to fix it.
Warning: a promise was created in a handler at anonymous> (/opt/testproj/node_modules/pipeworks/pipeworks.js:72:17but was not returned from it, see http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-was-not-returned-from-it at new Promise (/opt/testproj/node_modules/bluebird/js/release/promise.js:77:14)
Sample code:
const bluebird = require('bluebird');
const options = {
promiseLib: bluebird
};
const pgpromise = require('pg-promise')(options);
const connectionString = `postgres://${user}:${password}@${host}:${port}/${database}`;
const db = pgpromise(connectionString);
db.func('student__find_by_id', [id])
.then((data) => {
return res.json(data);
}).catch((err) => {
log.error(err);
});
Upvotes: 0
Views: 1130
Reputation: 25840
As per my earlier comments, the code shown here cannot throw the error you describe. And situations like this one are comprehensively covered within pg-promise tests.
You should use Bluebird's Long Stack Tracing feature to correctly identify the code that results in this error:
var Promise = require('bluebird');
Promise.config({
longStackTraces: true
});
Upvotes: 2