v1.6.2 throws on getConnection when using createPoolCluster
See original GitHub issueWhen creating a cluster
using mysql.createPoolCluster()
the call to cluster.getConnection()
throws in 1.6.2. This worked fine in previous versions of mysql2.
Run the following code to reproduce the bug:
const mysql = require('mysql2')
const cluster = mysql.createPoolCluster()
cluster.add({ host: 'localhost', user: 'root', database: 'test' })
// This call throws
cluster.getConnection(function (err, conn) {
if (err) throw err
console.log('success!')
})
This code will throw the following error:
/tmp/node_modules/mysql2/lib/pool_cluster.js:36
this._selector = new Selector[selector]();
^
TypeError: Selector[selector] is not a constructor
at new PoolNamespace (/tmp/node_modules/mysql2/lib/pool_cluster.js:36:22)
at PoolCluster.of (/tmp/node_modules/mysql2/lib/pool_cluster.js:96:31)
at PoolCluster.getConnection (/tmp/node_modules/mysql2/lib/pool_cluster.js:121:24)
at Object.<anonymous> (/tmp/test.js:8:9)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
at tryModuleLoad (internal/modules/cjs/loader.js:544:12)
at Function.Module._load (internal/modules/cjs/loader.js:536:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:760:12)
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (11 by maintainers)
Top Results From Across the Web
How to use the mysql.createPoolCluster function in mysql - Snyk
To help you get started, we've selected a few mysql.createPoolCluster examples, based on popular ways it is used in public projects.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That said, I apologize for causing this regression, I’d never seen that one coming 😛
@sidorares works now, thanks 👍