tedious icon indicating copy to clipboard operation
tedious copied to clipboard

Not emitting error when fail to connect to database expecting encrypt = true

Open slmmm opened this issue 9 years ago • 3 comments

I've not been able to determine why mssql (3.3.0) is not emitting an error event when tedious fails to connect to a database that expects encrypted connect but the options.encrypt = false. It seems that tedious is not emitting the error.

I've stepped in through mssql main.js down into selection of tedious driver and as far as the tedious call for new Connection (in tedious.js) c = new tds.Connection(cfg); // this fails but not emitting error Stepping further into the tds.Connection call, am getting to the connectOnPort function, but after attempt to connect socket, hang occurs at this.socket.connect(connectOpts); // tedious connection.js fails if encrypt not set appropriately

I've attempted to catch an error in multiple means (callback, promise, or event listener), but mssql doesn't allow or catch (depending on the case) the error.

Can this issue be resolved? This failure crashes the node application as the hang-up never resolves, not even with timeout settings on the connection options or pool.

Attaching comparison of debug logs (stripped packets for readability) when fails (missing encrypt) vs succeeds (encrypt set): mssql_debug_failingsocketonmissingencrypt

slmmm avatar Jul 18 '17 22:07 slmmm

Fwiw, I've submitted #606 explicitly to auto-escalate the ecnryption when the client configuration doesn't specify encrypt=true, but the server requires it.

ciaranj avatar Jul 31 '17 21:07 ciaranj

This should've been fixed by https://github.com/tediousjs/tedious/pull/514 Can you see if your versions of tedious has this fix?

tvrprasad avatar Sep 05 '17 16:09 tvrprasad

#514 fixes this issue.

Suraiya-Hameed avatar Jul 19 '18 23:07 Suraiya-Hameed