Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Postgres unhandled promise rejection #1319

@richardscarrott

Description

@richardscarrott

We're getting unhandled promise rejections from the pg module (via postgraphile) only when the trace agent is enabled:

err: {
      "type": "Error",
      "message": "[Redacted]",
      "stack":
          [Redacted]
              at Connection.parseE (/usr/src/app/node_modules/pg/lib/connection.js:554:11)
              at Connection.parseMessage (/usr/src/app/node_modules/pg/lib/connection.js:379:19)
              at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:119:22)
              at Socket.emit (events.js:210:5)
              at addChunk (_stream_readable.js:309:12)
              at readableAddChunk (_stream_readable.js:290:11)
              at Socket.Readable.push (_stream_readable.js:224:10)
              at TCP.onStreamRead (internal/stream_base_commons.js:182:23)
      "constraint": "[Redacted]",
      "file": "execMain.c",
      "line": "1762",
      "routine": "ExecConstraints"
    }

Environment details

System:
OS: Linux 4.9 Debian GNU/Linux 9 (stretch) 9 (stretch)
Binaries:
Node: 12.14.0 - /usr/local/bin/node
Yarn: 1.21.1 - /usr/local/bin/yarn
npm: 6.13.4 - /usr/local/bin/npm
Packages:

Steps to reproduce

I've not got a reduced test case but in our express server using postgraphile a DB constraint violation error on insert results in an unhandled promise rejection. Removing the trace agent prevents this from occurring so I'm guessing the promise is forked by the trace agent but not handled.

Metadata

Metadata

Assignees

Labels

api: cloudtraceIssues related to the googleapis/cloud-trace-nodejs API.priority: p2Moderately-important priority. Fix may not be included in next release.status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions