-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: check existence of functions on prototype instead
- Loading branch information
1 parent
225289d
commit 2968836
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,7 +153,9 @@ export function getConnectionPrototypeToInstrument(connection: any) { | |
|
||
// [email protected] included a refactoring, where most code was moved out of the `Connection` class and into a shared base | ||
// so we need to instrument that instead, see https://github.com/sidorares/node-mysql2/pull/3081 | ||
if (basePrototype?.constructor?.name === 'BaseConnection') { | ||
// This checks if the functions we're instrumenting are there on the base - we cannot use the presence of a base | ||
// prototype since EventEmitter is the base for mysql2@<=3.11.4 | ||
if (typeof basePrototype?.query === 'function' && typeof basePrototype?.execute === 'function') { | ||
return basePrototype; | ||
} | ||
|
||
|