TypeError: con.connect is not a function

I trying to connect PostgreSQL to Glitch, where I stored my backend.

my db.js file code:

const { Pool } = require(‘pg’);

const pool = new Pool({
host: process.env.PGHOST,
database: process.env.PGDATABASE,
username: process.env.PGUSER,
password: process.env.PGPASSWORD,
port: 5432,
ssl: ‘require’,
connection: {
options: project=${process.env.ENDPOINT_ID},
},
});

module.exports = {pool};

my user.controller.js file have a function:

const {pool} = require(‘…/…/services/db’);

async function checkIfUserExists(email) {
const existUser = await pool.query(getUserByEmail, [email]);

return existUser.rows;
}

This function checkIfUserExists returns TypeError: con.connect is not a function.

Please help me to deal with that.

I don’t know how, but now it is worked

It’s worth noting that con is not defined in the code example :grin:
But glad it’s all working out…