-
-
Notifications
You must be signed in to change notification settings - Fork 642
Closed
Description
I get this Error after updating to 3.6.0:
/home/phx/phxAssistant/api/node_modules/mysql2/promise.js:356
const localErr = new Error();
^
Error: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
it works fine with the previous version 3.5.2
Here is my call:
const pool = require('mysql2')
.createPool({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_DATABASE,
connectionLimit: 5,
multipleStatements: true,
dateStrings: true,
typeCast: function (field, next) {
if (field.type === 'TINY' && field.length == 1) {
return field.string() === '1'; // true / false
} else if (field.type === 'BLOB' && (field.length == 4294967295 || field.db === '')) {
let value = field.string();
if (/^-?\d+$/.test(value)) return value;
try {
let res = JSON.parse(value);
return res;
} catch (e) {
return value;
}
}
return next();
},
})
.promise();
exports.query = async function (...args) {
return (await pool.query(...args))[0];
};