aakrit512
aakrit512
DTDrizzle Team
Created by aakrit512 on 8/2/2023 in #help
PostgreSQL migration issue in AWS RDS with Drizzle ORM: 'no pg_hba.conf entry for host' error
I've been using drizzle for a new project over the past few weeks, and it has provided a great developer experience. Now, it's time to bring the app to production. However, I'm currently facing an issue with the migrations. The app is deployed in AWS ECS and connects to a PostgreSQL database in AWS RDS. I have provided the necessary IAM policies in the ECS task role to access the RDS instance. The connection is established but after that when I execute the migrate function, I'm encountering an error that I didn't experience while running locally.
PostgresError: no pg_hba.conf entry for host <MY_EC2_IP>, user <MY_USER>, database <MY_DATABASE>, no encryption
at ErrorResponse (/app/node_modules/postgres/cjs/src/connection.js:771:26)
at handle (/app/node_modules/postgres/cjs/src/connection.js:473:6)
at Socket.data (/app/node_modules/postgres/cjs/src/connection.js:314:9)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
PostgresError: no pg_hba.conf entry for host <MY_EC2_IP>, user <MY_USER>, database <MY_DATABASE>, no encryption
at ErrorResponse (/app/node_modules/postgres/cjs/src/connection.js:771:26)
at handle (/app/node_modules/postgres/cjs/src/connection.js:473:6)
at Socket.data (/app/node_modules/postgres/cjs/src/connection.js:314:9)
at Socket.emit (node:events:513:28)
at Socket.emit (node:domain:489:12)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Socket.Readable.push (node:internal/streams/readable:228:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
I tried changing postgres client. I had never experienced such issue when using other ORMs like Prisma and TypeORM. Is this something specific to how Drizzle executes SQL in Postgres?
4 replies