Skip to content

[BUG]: pg deprecation warning when accesing Client.activeQuery #7267

@Reversive

Description

@Reversive

Tracer Version(s)

5.82.0

Node.js Version(s)

20.x

Bug Report

The pg instrumentation triggers a deprecation warning with pg v8.17+:
(node:1) DeprecationWarning: Client.activeQuery is deprecated and will be removed in a future version.

pg v8.17.0+ deprecated activeQuery in PR #3510. The property is now a getter that emits a warning and proxies to the internal _activeQuery:

// from packages/pg/lib/client.js
const activeQueryDeprecationNotice = nodeUtils.deprecate(
  () => {},
  'Client.activeQuery is deprecated and will be removed in a future version.'
)

get activeQuery() {
  activeQueryDeprecationNotice()
  return this._activeQuery
}

Seems like the current code evaluates this.activeQuery first which triggers the getter that emits the deprecation warning:

const queryQueue = this.queryQueue || this._queryQueue
const activeQuery = this.activeQuery || this._activeQuery

The same applies to queryQueue

Reproduction Code

No response

Error Logs

No response

Tracer Config

No response

Operating System

No response

Bundling

ESBuild

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions