sidorares / sidorares/node-mysql2

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined

Open
#3,208 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs reproduction
Dominant language
TypeScript
Stars
4.4k
Forks
680
Avg merge
9h 7m
Merged PRs (30d)
59

Description

WX20241114-124213

`
var config = {
host: 'xxx',
port: 3306,
user: 'root',
password: 'xxx',
database: 'xxxx',
waitForConnections: true,
connectionLimit: 10,
queueLimit: 0
};
var mysql = require('mysql2');
var pool = mysql.createPool(config);
var promisePool = pool.promise();

var sql = insert into memo_check_file(openid, relation_id, type, size, url, status, time) values(?, ?, ?, ?, ?, 1, now());
var params = [openid, relation_id, type, size, url];
var [rows, fields] = await promisePool.query(sql, params);
`
Calling like this will occasionally report an error like this,How to solve it?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown mysql2 createPool/promisePool query and capture the complete error stack and parameter values when the failure occurs. Done means reproducing the intermittent failure or isolating which query input is undefined, with a confirmed fix or clear maintainer guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mysql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.