Improve pg-promise stack traces

Posted on Aug 27, 2020

featured image

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.

Side Widget
You can put anything you want inside of these side widgets. They are easy to use, and feature the new Bootstrap 4 card containers!