pool = require('mysql').createPool(
{
connectionLimit : 5,
host,
user,
password
}),
getConnection = promisify(pool.getConnection),
connection = await getConnection(),
TypeError: Cannot read property 'length' of undefined
at Pool.getConnection (/opt/provision/node_modules/mysql/lib/Pool.js:36:29)
at internal/util.js:238:30
at module.exports.createTransaction (/opt/provision/model/db/gateway/mysql.js:33:33)
at Noc.createTransaction (/opt/provision/model/db/repository/noc.js:11:32)
at module.exports (/opt/provision/model/activate-order.js:14:35)
at module.exports.activate (/opt/provision/controller/activate-order.js:24:13)
at module.exports.post (/opt/provision/controller/activate-order.js:15:23)
at module.exports.dispatch (/opt/provision/node_modules/@superhero/core/controller/dispatcher/rest.js:23:42)
at module.exports.dispatch (/opt/provision/node_modules/@superhero/core/controller/server/http.js:53:49)
at <anonymous>
Forgot to bind the instance....
Hi, I have the exact same issue, care to elaborate how you resolve it? Thanks!
Edit:
Just resolved the problem.
const getConnection = util.promisify(pool.getConnection.bind(pool));
Most helpful comment
Hi, I have the exact same issue, care to elaborate how you resolve it? Thanks!
Edit:
Just resolved the problem.
const getConnection = util.promisify(pool.getConnection.bind(pool));