-->

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.
Sumber https://rafibanget.blogspot.com/

Baca juga: