How to FIx Cannot enqueue Handshake after already enqueuing a Handshake

Hello guys, back with me. In the nigh i will share about how to fix error in nodejs + mysql. This is a error message "Cannot enqueue Handshake after already enqueuing a Handshake".

Why i get this error ? it is a bug in mysql module, you dont need to connect if you already create createConnection. so you must delete your connection and delete end connection.

below is the example code.

Before

var con = require('../databases/db');

/* GET users listing. */
router.get('/', function(req, res, next) {
 con.connect(function(err) {
   if (err) throw err;
   con.query("SELECT * FROM Kriteria", function (err, result, fields) {
     if (err) throw err;
     res.render('kriteria/index',{
      kriterias:result
     });
   });
 });
});
After delet connection

var con = require('../databases/db');

/* GET users listing. */
router.get('/', function(req, res, next) {
   con.query("SELECT * FROM Kriteria", function (err, result, fields) {
     if (err) throw err;
     res.render('kriteria/index',{
      kriterias:result
     });
   });
});

Now, you solve your problem.

Subscribe to receive free email updates:

0 Response to "How to FIx Cannot enqueue Handshake after already enqueuing a Handshake"

Post a Comment

1. Berikan Komentar yang Relevan
2. Tidak Mengandung SARA
3. Berkomentar yang Sopan

Konsultasi Aplikasi