postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Error Message Error: write CONNECT_TIMEOUT with BUN

Open approached opened this issue 2 years ago • 2 comments

Hi @ all

I'm a bit frustrated. I use bun + elysiajs + drizzle ORM + docker and have a cronjob every 5 minutes. I get an error every now and then without a recognisable pattern:

Error Error {
  stack: "Error: write CONNECT_TIMEOUT postgres13:5432\n    at connection 
(/app/node_modules/postgres/src/errors.js:26:9)\n    at connectTimedOut 
(/app/node_modules/postgres/src/connection.js:256:19)\n    at done 
(/app/node_modules/postgres/src/connection.js:1016:12)",
  query: undefined,
  parameters: undefined,
  args: [ "ACTIVE", false, "2023-12-02T04:25:00", "2023-12-02T04:29:59" ],
  types: null,
  message: "write CONNECT_TIMEOUT postgres13:5432",
  code: "CONNECT_TIMEOUT",
  errno: "CONNECT_TIMEOUT",
  address: "postgres13",
  port: 5432,
  toString: [Function: toString],
  name: "Error"

My query looks like:

const items: AppointmentParticipant[] | unknown =
			await db.query.appointments.findMany({
				where: and(
					eq(appointments.status, "ACTIVE"),
					eq(appointments.isDecline, false),
					between(appointments.notificationAt, filterFrom, filterTo),
				),
				with: {
					appointmentParticipants: true,
				},
			});

If the error has occurred then no further query can be created. The PostgresSQL database itself does not give an error message. The user uses a connection limit: -1.

Does anyone have an idea how I can debug it better? Or an idea what the problem could be?

approached avatar Dec 02 '23 13:12 approached

This issue is already patched on #738 and will be released soon.

wackfx avatar Dec 11 '23 22:12 wackfx

When is this going to be released? Currently having this issue in one of my apps and would really appreciate a more concrete schedule on when users can expect a fix.

jonahsnider avatar Feb 03 '24 17:02 jonahsnider