Closed minh5micron closed 1 month ago
i experienced the same thing, did you fix it ?
Unfortunately, we had to switch back to Node + Typescript. We can only suspect that Postgresjs might be the main reason of this instability.
This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.
I am unable to connect to my PostgreSQL database when using a ca
cert
import postgres from "postgres";
import { DB_CA, DB_URL } from "./constants";
import type { ConnectionOptions } from 'node:tls';
const options: ConnectionOptions = {
ca: DB_CA,
};
const queryClient = postgres(DB_URL, options);
The same code works on 1.1.4
, but not on latest
@bnussman are you getting a connection timeout? what's the error you're seeing? is there a chance you could let us know what type of certificate is in use? or if it's using a managed postgres instance, what provider? it would help us if you could provide some way for us to reproduce the authentication mechanism
@Jarred-Sumner Yeah, a timeout using a managed Postgres (v13.2) database on Linode.
Error: write CONNECT_TIMEOUT lin-1010-21-pgsql-primary.servers.linodedb.net:5432
at connectTimedOut (/home/banks/Development/beep/apinext/node_modules/postgres/src/connection.js:257:20)
at done (/home/banks/Development/beep/apinext/node_modules/postgres/src/connection.js:1033:8)
I also get this error when trying with a different client
Error: Connection terminated unexpectedly
at <anonymous> (/home/banks/Development/beep/node_modules/pg/lib/client.js:132:77)
at onceWrapper (node:events:37:21)
at emit (node:events:201:48)
at <anonymous> (/home/banks/Development/beep/node_modules/pg/lib/connection.js:63:12)
at emit (node:events:201:48)
at emitCloseNT (node:stream:1433:25)
at processTicksAndRejections (:12:39)
Working on gathering more detail. Will update shortly
this may have been fixed by https://github.com/oven-sh/bun/pull/11322
if this is still affecting you in the latest version of Bun (you may need to run bun upgrade
) please leave a comment and let us know. for now we're going to mark this as closed.
What version of Bun is running?
1.0.26
What platform is your computer?
Linux 5.15.0-67-generic x86_64 x86_64
What steps can reproduce the bug?
We have Postgresql database size around 200Mb. Our web server code is written in TS + Expressjs, Postgresjs to connect to the local database and the app is run by Bun. We also use pm2 to start/restart and monitor the app itself. However it's strange that after around somewhere from 10 to 20 hours there is connection time out issue with the database.
The database is still active without errors. We restart the app by "pm2 restart" and the connection timeout issue is disappeared. Therefore we suspect that somehow Bun + Postgresjs is not stable enough though we have no ways to debug it. It would be nice if anyone can explain for us or show us some ways to debug :)
It is worth mentioning that we use the combo pm2 + Node + express + postgresjs before and never encountered into this issue before. The reason why we are trying to switch to Bun is mostly because of its support of Typescript out-of-the-box.
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response