Pg-promise: WARNING: Creating a duplicate database object for the same connection

Created on 17 Mar 2017  路  1Comment  路  Source: vitaly-t/pg-promise

Hi,

Is there a way to suppress (or better yet fix) the following warning:
WARNING: Creating a duplicate database object for the same connection

I have an express application which initializes pg-promise on start and calls pgp.end() when the application
exits.

I am starting/stopping my app in a series of mocha tests and I get this warning even though I call pgp.end().

Any ideas what I might be doing wrong here?

Most helpful comment

@blendsdk you should follow this pattern: http://stackoverflow.com/questions/34382796/where-should-i-initialize-pg-promise

and initialize your database object only once per connection, and then share it.

>All comments

@blendsdk you should follow this pattern: http://stackoverflow.com/questions/34382796/where-should-i-initialize-pg-promise

and initialize your database object only once per connection, and then share it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leemhenson picture leemhenson  路  5Comments

normanfeltz picture normanfeltz  路  4Comments

seanh1414 picture seanh1414  路  4Comments

ForbesLindesay picture ForbesLindesay  路  3Comments

hawkeye64 picture hawkeye64  路  4Comments