Skip to content

Conversation

@sidpremkumar
Copy link
Contributor

@sidpremkumar sidpremkumar commented Jan 2, 2026

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

We have been seeing errors:

2025-12-31 04:02:27.243 | at <anonymous> (/app/node_modules/pg-pool/index.js:216:18)
2025-12-31 04:02:27.243 | at <anonymous> (/app/node_modules/@effect/sql-pg/dist/esm/PgClient.js:232:7)
2025-12-31 04:02:27.243 | TypeError: undefined is not an object (evaluating 'client.on')
2025-12-31 04:02:27.243 | ^
2025-12-31 04:02:27.243 | 232 | client.on("error", onError);
2025-12-31 04:02:27.243 | 231 | }
2025-12-31 04:02:27.243 | 230 | cause = cause_;
2025-12-31 04:02:27.243 | 229 | function onError(cause_) {
2025-12-31 04:02:27.243 | 228 | }

We have tried modifying and guarding better on our application code - but this issue persisted. We think it's coming from here, specifically the client! assertion that causes the entire app to crash and restart our application.

Believe this can be fixed by making sure the client exists before calling on error.

This seems to be known:
Ref: brianc/node-postgres#2492 (comment)

If the connection creation or acquisition encounters an error then the client arg is undefined and the done callback is a no-op function.

Related

n/a

@github-project-automation github-project-automation bot moved this to Discussion Ongoing in PR Backlog Jan 2, 2026
@changeset-bot
Copy link

changeset-bot bot commented Jan 2, 2026

🦋 Changeset detected

Latest commit: 7f65ef9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/sql-pg Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sidpremkumar sidpremkumar marked this pull request as ready for review January 2, 2026 14:32
@sidpremkumar sidpremkumar marked this pull request as draft January 2, 2026 17:38
@sidpremkumar sidpremkumar marked this pull request as ready for review January 2, 2026 17:38
Copy link
Contributor

@tim-smart tim-smart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Just needs a lint fix and a changeset

@sidpremkumar sidpremkumar requested a review from tim-smart January 3, 2026 14:24
@tim-smart tim-smart merged commit c5a1e33 into Effect-TS:main Jan 3, 2026
11 checks passed
@github-project-automation github-project-automation bot moved this from Discussion Ongoing to Done in PR Backlog Jan 3, 2026
@github-actions github-actions bot mentioned this pull request Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants