postgres: Timeout issue when using with Bun
I created a simple http server with http.createServer, and query database when requests come:
let rows = await sql.unsafe(query, args, { prepare: true })
After starting the server it works fine at beginning. But if do not send request after a while (maybe 1+ hour), then send request again, got query timeout:
22 | errno: x,
23 | address: options.path || host
24 | }, options.path ? {} : { port: port }
25 | )
26 | Error.captureStackTrace(error, connection)
^
error: write CONNECT_TIMEOUT localhost:5432
code: "CONNECT_TIMEOUT"
at connection (/home/test/node_modules/postgres/src/errors.js:26:9)
at connectTimedOut (/home/test/node_modules/postgres/src/connection.js:433:14)
at done (/home/test/node_modules/postgres/src/connection.js:1035:12)
This issue only occurs on Bun, not on Node.(I’ve tested both)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 3
- Comments: 17 (6 by maintainers)
v3.4.4 released
I have the same issue. Seems to be fixed in November in #738 but there hasn’t been any releases to npm.
@porsager is there any reason there hasn’t been any releases to npm?
@wiesys I’m using Postgres.js 3.4.4 on Bun 1.1.8 and the issue is still present.
The fix for this will land in Bun v1.1.7, which we aim to release in a few hours
You should go thumb up that issue on bun 😉 https://github.com/oven-sh/bun/issues/7325
You can install from github by using
porsager/postgres#commithash@Jarred-Sumner Its still there. https://github.com/oven-sh/bun/issues/7325#issuecomment-2123535963
right, the “workaround” solving the previous bun error probably shouldn’t have been made, and instead solved in bun instead 😅
So from now on I’m not taking bug reports from bun anymore 😜 Bun has stated “many” times, that things working in node should work in bun, and bug reports should go to the bun repo then.