Skip to content

Connection terminated unexpectedly #1611

Open
@JohnsiJohn

Description

@JohnsiJohn

Im trying to connecto to remote database.
I can connect using psql client.
But i get "Connection terminated unexpectedly" error while trying to run this (with same connection string as in psql clinet):

const { Pool, Client } = require('pg')
const connectionString = '...'

const pool = new Pool({
  connectionString: connectionString,
})

pool.query('SELECT NOW()', (err, res) => {
  console.log(err, res)
  pool.end()
})

const client = new Client({
  connectionString: connectionString,
})
client.connect()

client.query('SELECT NOW()', (err, res) => {
  console.log(err, res)
  client.end()
})

ive been trying to connect within sequelize ORM, but got same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions