denodrivers / denodrivers/postgres

TLS `caCertificates` not working

Open
#506 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
655
Forks
97
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Attempting to connect to database with these options fail with error: "The certificate used to secure the TLS connection is invalid: Bad resource ID"

```
tls: {
enforce: true, // Set this to false if using localhost
caCertificates: [await Deno.readTextFile('./pg-server-ca.pem')],
},
```

However, this simple connection test succeeds:
```
const conn = await Deno.connectTls({
hostname: Deno.env.get('PG_HOST'),
port: 5432,
caCerts: [await Deno.readTextFile("pg-server-ca.pem")],
});
```

**To Reproduce**
Try the code/steps above.

**Expected behavior**
PG should connect, but it does not.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.