I'm creating a promise based API. Everything works fine if I make one request at a time, but, if 2 or more requests hit the server within a second of each other, I get the following error

Error: Cannot enqueue Quit after invoking quit

 db = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: '',
  // database: 'my_db'
});

// db.connect = (err) => {
//   if (err) throw err;
//   console.log('mysql connected');

// };
//创建数据库

app.get('/create', (res, req) => {
  let sql = 'CREATE DATABASE nodemysql';
  db.query(sql, (err, result) => {
    if (err) throw err;
    console.log(result);
    res.send('Database create')
  })
})
// db.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
//   if (error) throw error;
//   console.log('The solution is: ', results[0].solution);
// });

// db.end();

If you using the node-mysql module, just remove the .connect and .end. Just solved the problem myself. Apparently they pushed in unnecessary code in their last iteration that is also bugged. You don't need to connect if you have already ran the createConnection call