Cannot read property 'slice' of undefined
See original GitHub issueconst mysql = require("mysql2/promise");
var mpool = mysql.createPool({
connectionLimit: 10,
host: process.env.MYSQL_IP,
user: process.env.MYSQL_USER,
password: process.env.MYSQL_PASSWORD,
database: process.env.MYSQL_DB,
});
async function getSomething() {
const [rows, fields] = await mpool.execute(
`select query`
);
console.log(rows);
}
query never runs and outputs this error below. isql is working with same login settings:
node_modules/mysql2/lib/auth_41.js:78 const authPluginData2 = scramble2.slice(0, 12);
^
TypeError: Cannot read property ‘slice’ of undefined at Object.exports.calculateTokenFromPasswordSha (node_modules/mysql2/lib/auth_41.js:78:37) at Object.token [as calculateToken] (node_modules/mysql2/lib/auth_41.js:68:18) at new HandshakeResponse (node_modules/mysql2/lib/packets/handshake_response.js:28:26) at ClientHandshake.sendCredentials (node_modules/mysql2/lib/commands/client_handshake.js:52:31) at ClientHandshake.handshakeInit (node_modules/mysql2/lib/commands/client_handshake.js:137:12) at ClientHandshake.execute (node_modules/mysql2/lib/commands/command.js:39:22) at PoolConnection.handlePacket (/node_modules/mysql2/lib/connection.js:425:32) at PacketParser.onPacket (node_modules/mysql2/lib/connection.js:75:12) at PacketParser.executeStart (node_modules/mysql2/lib/packet_parser.js:75:16) at Socket.<anonymous> (node_modules/mysql2/lib/connection.js:82:25)
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (7 by maintainers)
For something that was released 17 years ago, I would say not a lot 😂
we don’t have to support every old server version, but I think good behaving driver should not 1) crash when server version is not supported 2) return good error explaining what happened and how to fix
re particular version ( 4.1 and older ) - not sure how many people use it. I’d say not enough to justify dev effort but don’t have evidence to support. There is always drop in
mysqljs/mysql
replacement for those who must use old server