Setting mysql connectTimeout from sequelize config

3,479 views
Skip to first unread message

Donald Hook

unread,
Jul 18, 2015, 10:42:56 AM7/18/15
to sequ...@googlegroups.com
I am trying to increase the connectTimeout config setting for mysql in my application that uses angular, sequelize and mysql.  

When i startup my debugger, i end up timing out with a ETIMEDOUT exception.  

Where can I set connectTImeout so that Sequelize can pass it to MySQL?  

I currently have my envirornment config set as follows.  

module.exports = {
db2: 'mongodb://localhost/jobactivitytracking',
mysql: {
dbname: 'jobactivitytracking',
username: 'dhook',
password: 'dhook611',
host: 'localhost',
port: '3306',
timeout: 100000
},

Thanks



h:\workspace\MeanJS\JobActivityEntry\node_modules\connect-mysql\lib\connect-mysql.js:92
        }, function(err) { if(err) throw err; });
                                         ^
Error: connect ETIMEDOUT
    at Connection._handleConnectTimeout (h:\workspace\MeanJS\JobActivityEntry\node_modules\mysql\lib\Connection.js:362:13)
    at Socket.g (events.js:199:16)
    at Socket.emit (events.js:104:17)
    at Socket._onTimeout (net.js:348:8)
    at _makeTimerTimeout (timers.js:476:11)
    at Timer.unrefTimeout (timers.js:540:5)
    --------------------
    at Protocol._enqueue (h:\workspace\MeanJS\JobActivityEntry\node_modules\mysql\lib\protocol\Protocol.js:135:48)
    at Protocol.handshake (h:\workspace\MeanJS\JobActivityEntry\node_modules\mysql\lib\protocol\Protocol.js:52:41)
    at Connection.connect (h:\workspace\MeanJS\JobActivityEntry\node_modules\mysql\lib\Connection.js:123:18)
    at module.exports.MySQLStore.query.retry (h:\workspace\MeanJS\JobActivityEntry\node_modules\connect-mysql\lib\connect-mysql.js:175:40)
    at MySQLStore.module.exports.MySQLStore.query (h:\workspace\MeanJS\JobActivityEntry\node_modules\connect-mysql\lib\connect-mysql.js:189:9)
    at new MySQLStore (h:\workspace\MeanJS\JobActivityEntry\node_modules\connect-mysql\lib\connect-mysql.js:72:14)
    at module.exports (h:\workspace\MeanJS\JobActivityEntry\config\express.js:109:10)
    at Object.<anonymous> (h:\workspace\MeanJS\JobActivityEntry\server.js:29:38)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.runMain [as _onTimeout] (module.js:501:10)
    at Timer.listOnTimeout (timers.js:119:15)

Process finished with exit code 1

Mick Hansen

unread,
Jul 20, 2015, 3:06:58 AM7/20/15
to Donald Hook, sequ...@googlegroups.com
I would assume connection timeouts are generally controlled from the server?
If https://github.com/felixge/node-mysql/ support setting such a value you can set `dialectOptions` on the Sequelize constructor to pass along options directly to node-mysql.
--
Mick Hansen
@mhansendev
mhansen.io

Donald Hook

unread,
Jul 20, 2015, 7:55:18 AM7/20/15
to sequ...@googlegroups.com, donal...@gmail.com
Thanks Mick.  I will give that a shot.
Reply all
Reply to author
Forward
0 new messages