tedious: Could not connect (sequence) - ESOCKET

Hi, Im experimenting an error using mssql library for nodejs. I am using PoolConnection from mssql (and I also tried using tedious-pool-connection library). The app Im running simply connects to a SQL server db and executes some writing queries. Multiple queries at the same time, or in serial order, it doesn’t matter: I always get this kind of errors for some queries:

ConnectionError: Failed to connect to <DB_URL>:1433 - Could not connect (sequence)
    at Connection.<anonymous> (<PROJECT_DIR>/node_modules/mssql/lib/tedious/connection-pool.js:68:17)
    at Object.onceWrapper (events.js:421:26)
    at Connection.emit (events.js:314:20)
    at Connection.socketError (<PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connection.js:1290:12)
    at <PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connection.js:1116:21
    at SequentialConnectionStrategy.connect (<PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connector.js:87:14)
    at Socket.onError <PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connector.js:100:12)
    at Socket.emit (events.js:314:20)
    at emitErrorNT (internal/streams/destroy.js:92:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) {
  code: 'ESOCKET',
  originalError: ConnectionError: Failed to connect to <DB_URL>:1433 - Could not connect (sequence)
      at ConnectionError (<PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/errors.js:13:12)
      at Connection.socketError (<PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connection.js:1290:56)
      at <PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connection.js:1116:21
      at SequentialConnectionStrategy.connect (/<PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connector.js:87:14)
      at Socket.onError (<PROJECT_DIR>/node_modules/mssql/node_modules/tedious/lib/connector.js:100:12)
      at Socket.emit (events.js:314:20)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:84:21) {
    code: 'ESOCKET'
  }
}

What could be causing this issue?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

Ok, I dont understand which is the reason for that, it all depends on how mssql library is hadling the connection internally. Will check with them. Thanks!

No worries, happy to help 😄

The SENT_TLSSSLNEGOTIATION is the state of tedious when it’s trying to establish TLS/SSL connection to the server (in the pre-login stage). This can be thrown in various ways, but I’m guessing you’re trying to send a request while the driver is not yet connected to the server.