porsager / postgres

Postgres.js - The Fastest full featured PostgreSQL client for Node.js, Deno, Bun and CloudFlare
The Unlicense
7.03k stars 255 forks source link

Crash from unestablished connection #896

Open joshxyzhimself opened 2 weeks ago

joshxyzhimself commented 2 weeks ago

Getting the following error when it fails to establish connection.

More context:

file://server/node_modules/postgres/src/connection.js:389
      stack: { value: err.stack + query.origin.replace(/.*\n/, '\n'), enumerable: options.debug },
                                               ^

TypeError: Cannot read properties of undefined (reading 'replace')
    at queryError (file://server/node_modules/postgres/src/connection.js:389:48)
    at errored (file://server/node_modules/postgres/src/connection.js:384:17)
    at Socket.error (file://server/node_modules/postgres/src/connection.js:376:5)
    at Socket.emit (node:events:519:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v20.13.1

Similar scenarios here: https://github.com/kysely-org/kysely-postgres-js/issues/60

Thank you thank you <3