# Own database PostgresSQL no longer functionall

**URL:** <https://community.auth0.com/t/own-database-postgressql-no-longer-functionall/96164>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [December 10, 2022, 4:33am UTC](https://community.auth0.com/t/own-database-postgressql-no-longer-functionall/96164 "2022-12-10T04:33:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MeDavid](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/medavid/32/25649_2.png) [@MeDavid](https://community.auth0.com/u/MeDavid)\
**Post date:** [December 10, 2022, 4:33am UTC](https://community.auth0.com/t/own-database-postgressql-no-longer-functionall/96164/1 "2022-12-10T04:33:52Z")

</div>

Hi, I was using my own database to store my users, I didn’t make any changes neither in Auth0 or on my DB, yet as of today all routes are displaying this error “postgres.connect is not a function” I think Auth0 for some reason updated the pg package and the example they use for setting it up does no longer work.

```auto
function loginByEmail(email, callback) {
  //this example uses the "pg" library
  //more info here: https://github.com/brianc/node-postgres

  const postgres = require('pg');

  const conString = 'postgres://user:pass@localhost/mydb';
  postgres.connect(conString, function (err, client, done) {
    if (err) return callback(err);

    const query = 'SELECT id, nickname, email FROM users WHERE email = $1';
    client.query(query, [email], function (err, result) {
      // NOTE: always call `done()` here to close
      // the connection to the database
      done();

      if (err || result.rows.length === 0) return callback(err);

      const user = result.rows[0];

      return callback(null, {
        user_id: user.id,
        nickname: user.nickname,
        email: user.email
      });
    });
  });
}

```

Its there a way to specify a pg version?

---

<div class="post-metadata">

**Author:** ![MeDavid](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/medavid/32/25649_2.png) [@MeDavid](https://community.auth0.com/u/MeDavid)\
**Post date:** [December 10, 2022, 4:51am UTC](https://community.auth0.com/t/own-database-postgressql-no-longer-functionall/96164/2 "2022-12-10T04:51:43Z")

</div>

To clarify:  
I fixed it using that code on the bottom, yet I would like to still specify a pg version so I don’t have to go and change every single project I got any time a pg update comes on.

```auto
const { Client } = require("pg");
   const conString = new Client({
  connectionString: ''postgres://user:password@localhost/database''
});

  conString.connect((err, client) => {

```

---

<div class="post-metadata">

**Author:** ![vdgandrew](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vdgandrew/32/41898_2.png) [@vdgandrew](https://community.auth0.com/u/vdgandrew)\
**Post date:** [December 12, 2022, 10:15pm UTC](https://community.auth0.com/t/own-database-postgressql-no-longer-functionall/96164/3 "2022-12-12T22:15:22Z")

</div>

> I would like to still specify a pg version so I don’t have to go and change every single project I got any time a pg update comes on.

For Auth0 Node.js sandboxes, you can specify the version using the `package-name@x.y.z` format:

```auto
const { Client } = require("pg@8.7.1");

```

Auth0 only provides very specific versions for Node.js modules with 8.7.1 being the latest version available. If you want to use older versions on Auth0 sandbox environments, they are documented on [Can I Require?](https://auth0-extensions.github.io/canirequire/#pg).

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 21, 2022, 5:28pm UTC](https://community.auth0.com/t/own-database-postgressql-no-longer-functionall/96164/4 "2022-12-21T17:28:48Z")

</div>

Teamwork makes the dreamwork, thanks everybody for sharing all that with the rest of community!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 21, 2022, 5:28pm UTC](https://community.auth0.com/t/own-database-postgressql-no-longer-functionall/96164/5 "2022-12-21T17:28:50Z")

</div>


