Unable to connect AWS RDS to Node Application

0

I made AWS RDS instance made, Publicly accessible "Yes", have default VPC security group, have two imbound rules one default one and one custom rule as below

Name : blank, Security group rule ID : sgr-0d64f2e55ff6cf13d, IP version : IPv4, Type : PostgreSQL, Protocol : TCP, Port range : 5432, Source : 0.0.0.0/0 Description : blank

i'm able to connect using psql but when i try to connect using node & sequelize i get this error

Unable to connect to the database: ConnectionError [SequelizeConnectionError]: no pg_hba.conf entry for host "146.196.32.43", user "abhinay", database "tenant-core", no encryption

same in log: error/postgresql.log.2023-10-27-06

2023-10-27 06:14:42 UTC: 146.196.32.43(58328):abhinay@tenant-core:[8289]:FATAL: no pg_hba.conf entry for host "146.196.32.43", user "abhinay", database "tenant-core", no encryption

node db config

`const { Sequelize } = require("sequelize"); const { PGHOST, PGUSER, PGDATABASE, PGPASSWORD } = require("../../env");

const sequelize = new Sequelize(PGDATABASE, PGUSER, PGPASSWORD, { host: PGHOST, dialect: "postgres", operatorsAliases: 0, logging: false, pool: { max: 5, min: 0, acquire: 30000, idle: 10000, } })

const connectionTest = async () => { try { await sequelize.authenticate(); console.log('Connection has been established successfully.'); } catch (error) { console.error('Unable to connect to the database:', error); } } connectionTest()`

neither I'm able to telnet

Abhinay
asked 6 months ago1974 views
1 Answer
0
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions