Skip to content

[Bug]: Connection failure to postgres if connection must be encrypted #28

@scolastico

Description

@scolastico

Which project is this issue related to?

@not3/api

Version

2.0.1

Describe the bug

API errors out if DB only supports encrypted connections.

Steps to reproduce

Deploy with these envs:

    DATABASE_MODE: pg
    DATABASE_HOST: xxx.d.db.ondigitalocean.com
    DATABASE_PORT: xxx
    DATABASE_USERNAME: not-three
    DATABASE_PASSWORD: ${POSTGRES_PASSWORD}
    DATABASE_NAME: not-three

Expected behavior

No error

Error stacktrace (if applicable)

2026-02-05T12:02:19.507452123Z [Nest] 1  - 02/05/2026, 12:02:19 PM   FATAL [DatabaseService] Failed to connect to database

2026-02-05T12:02:19.508011247Z [Nest] 1  - 02/05/2026, 12:02:19 PM   FATAL [DatabaseService] error: no pg_hba.conf entry for host "xxx", user "not-three", database "not-three", no encryption

2026-02-05T12:02:19.508021607Z     at Parser.parseErrorMessage (/app/node_modules/.pnpm/pg-protocol@1.7.0/node_modules/pg-protocol/dist/parser.js:283:98)

2026-02-05T12:02:19.508024743Z     at Parser.handlePacket (/app/node_modules/.pnpm/pg-protocol@1.7.0/node_modules/pg-protocol/dist/parser.js:122:29)

2026-02-05T12:02:19.508027218Z     at Parser.parse (/app/node_modules/.pnpm/pg-protocol@1.7.0/node_modules/pg-protocol/dist/parser.js:35:38)

2026-02-05T12:02:19.508029261Z     at Socket.<anonymous> (/app/node_modules/.pnpm/pg-protocol@1.7.0/node_modules/pg-protocol/dist/index.js:11:42)

2026-02-05T12:02:19.508031445Z     at Socket.emit (node:events:524:28)

2026-02-05T12:02:19.508033460Z     at addChunk (node:internal/streams/readable:561:12)

2026-02-05T12:02:19.508035463Z     at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)

2026-02-05T12:02:19.508037488Z     at Readable.push (node:internal/streams/readable:392:5)

2026-02-05T12:02:19.508039692Z     at TCP.onStreamRead (node:internal/stream_base_commons:189:23)

Additional context

No response

Metadata

Metadata

Assignees

Labels

apibugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions