mssql (3.3.0) hanging when new Connection fails because database encrypt = true missing
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):

I believe this was fixed in the upstream version of Tedious which is released as part of v4.2.2.