title: In node pg client.query doesn't return
body: <p>I am currently updating a very old application to run on Heroku. I've had to update to the latest version of pg to support the latest postgres on heroku. However, this was originally abstracted out so it's all handled in the one file (below). I can connect to the DB successfully but <code>client.query</code> never returns.</p>
  
  <p>The first <code>console.log</code> is <code>SELECT * FROM public.user WHERE "email" = $1 [ 'xx@xx.com' ]</code>. However, I never reach the second <code>console.log</code>. I get no connection errors.</p>
  
  <p>I am using pg <code>7.x</code> and postgres 10.</p>
  
  <p>Any ideas?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const { Client } = require('pg');
  const config = require('.././app/models/config.js');
  const client = new Client({
   connectionString: process.env.DATABASE_URL || config.database || ''
  });
  
  var conString = config.database || '';
  
  client.connect();
  
  module.exports = {
   query: function(text, values, cb) {
    console.log(text, values);
    client.query(text, values, function(err, result) {
  
     console.log(err, result);
  
     if (err) {
      console.log(err);
     }
     if (cb) {
      cb(err, result);
     }
     client.end();
    });
   }
  };</code></pre>
  </div>
  </div>
  </p>