Skip to content

Problems with promise based pools after updating to 3.6.0 #2192

@BauerPh

Description

@BauerPh

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]; };

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions