Code: Select all
import { Client } from "jsr:@bartlomieju/postgres";
import "jsr:@std/dotenv/load";
const client = new Client({
user: Deno.env.get("POSTGRES_USER"),
database: Deno.env.get("POSTGRES_DB"),
hostname: Deno.env.get("POSTGRES_HOSTNAME"),
port: Deno.env.get("POSTGRES_PORT"),
});
client.connect();
console.log("connected");
await client.queryObject("SELECT * FROM blogs");
client.end();
Die Datenbank stellt eine Verbindung her, aber ich erhalte die folgende Fehlermeldung
Code: Select all
error: Uncaught (in promise) PostgresError: received unencrypted data after SSL request
throw new PostgresError(parseNoticeMessage(msg));
^
at assertSuccessfulStartup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/c
onnection.ts:80:13)
at Connection.#startup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/conne
ction.ts:394:7)
at eventLoopTick (ext:core/01_core.js:175:7)
at async Connection.startup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/
connection.ts:474:11)
at async Client.connect (https://jsr.io/@bartlomieju/postgres/0.17.2/client.ts:233:7
)
SSL explizit aus
Mit ssl: false und ssl=off in postgresql.conf, Ich erhalte die folgende Fehlermeldung:
Code: Select all
error: Uncaught (in promise) PostgresError: received unencrypted data after SSL request
throw new PostgresError(parseNoticeMessage(msg));
^
at assertSuccessfulStartup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/c
onnection.ts:80:13)
at Connection.#startup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/conne
ction.ts:394:7)
at eventLoopTick (ext:core/01_core.js:175:7)
at async Connection.startup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/
connection.ts:474:11)
at async Connection.query (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/co
nnection.ts:909:7)
at async Client.#executeQuery (https://jsr.io/@bartlomieju/postgres/0.17.2/client.ts
:256:12)
at async Client.queryObject (https://jsr.io/@bartlomieju/postgres/0.17.2/client.ts:4
34:12)
SSL explizit aktiviert
Mit ssl: true und ssl=on in postgresql.conf, Ich erhalte die folgende Fehlermeldung:
Code: Select all
error: Uncaught (in promise) ConnectionRefused: Connection refused (os error 61)
this.#conn = await Deno.connect(options);
^
at async Object.connect (ext:deno_net/01_net.js:583:55)
at async Connection.#openConnection (https://jsr.io/@bartlomieju/postgres/0.17.2/con
nection/connection.ts:246:18)
at async Connection.#startup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection
/connection.ts:322:7)
at async Connection.startup (https://jsr.io/@bartlomieju/postgres/0.17.2/connection/
connection.ts:474:11)
at async Client.connect (https://jsr.io/@bartlomieju/postgres/0.17.2/client.ts:233:7
)
Ich habe dafür gesorgt, dass brew services postgresql jedes Mal neu gestartet wird, wenn ich etwas in der Postgres-Konfigurationsdatei geändert habe, daher die obigen Ergebnisse sollte genau sein. Ich weiß, dass Deno.env.get funktioniert, aber ich bin mir nicht sicher, ob eine andere Konfiguration dies stören könnte.
Wie soll ich vorgehen?