When you execute a query with error, we get a
pg-promise
internal module-specific stack trace. That’s not really helpful, right?
What we want is to know which of our methods executed a query that failed
To do that we just tell pg-promise that uses bluebird as a promise lib
const bluebird = require('bluebird');
bluebird.config({ longStackTraces: true });
const pgp = require('pg-promise')({ promiseLib: bluebird });
Important: we have to set longStackTraces to false on production environments to avoid performance issues in termos of memory and CPU usage.
Photo by eberhard grossgasteiger on Unsplash