Skip to content

Issues with mysql2/promise #132

@derN3rd

Description

@derN3rd

Hey there,

We are using the mysql2 module with require('mysql2/promise') which causes the patch to fail:

/home/max/git/my-api/node_modules/dd-trace/src/plugins/mysql2.js:81
  shimmer.wrap(mysql2.Pool.prototype, 'getConnection', createWrapGetConnection(tracer, config))
                          ^

TypeError: Cannot read property 'prototype' of undefined
    at Object.patch (/home/max/git/my-api/node_modules/dd-trace/src/plugins/mysql2.js:81:27)
    at Array.from.filter.filter.forEach.plugin (/home/max/git/my-api/node_modules/dd-trace/src/instrumenter.js:72:16)
    at Array.forEach (<anonymous>)
    at Instrumenter.hookModule (/home/max/git/my-api/node_modules/dd-trace/src/instrumenter.js:67:8)
    at Function.Module._load (/home/max/git/my-api/node_modules/require-in-the-middle/index.js:69:30)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/max/git/my-api/node_modules/mysql2/lib/pool.js:1:75)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module._load (/home/max/git/my-api/node_modules/require-in-the-middle/index.js:25:24)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)

Node version: 8.4.0
dd-trace-js version: ^2.1.0
mysql2 version: ^1.5.2

I'm sure this has something todo with the Promise stuff from mysql2.

Is there any way I can use this module without rewriting my whole code?
Thanks in advance

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions