node-mysql2 icon indicating copy to clipboard operation
node-mysql2 copied to clipboard

Pooling over a socks5 proxy does not work

Open siddharthvp opened this issue 5 months ago • 0 comments

Example given in documentation (https://sidorares.github.io/node-mysql2/docs/documentation/extras#connecting-using-custom-stream) no longer works:

const mysql = require('mysql2');
const SocksConnection = require('socksjs');
const pool = mysql.createPool({
  database: 'test',
  user: 'foo',
  password: 'bar',
  stream: function (cb) {
    const newStream = new SocksConnection(
      { host: 'remote.host', port: 3306 },
      { host: 'localhost', port: 1080 }
    );
    cb(null, newStream);
  },
});

pool.query('SELECT 1')

gives:

Uncaught TypeError: cb is not a function

I couldn't figure out any way to pool over socks5 proxies, using either socks5js or the more popular socks package.

siddharthvp avatar Jun 18 '25 19:06 siddharthvp