I found the answer to this problem already and just want to document my finding.
When using recent versions of NW.js (and Node.js), I was having problems with the node-mssql / tedious module. Even a task as simple as connecting to a SQL Server server would throw a SSL routines:ssl_choose_client_version:unsupported protocol error.
The reason why the error is thrown has to do with a change in Node.js 12. Since version 12, the TLS settings were tightened, and TLS 1.2 is required by default. The SSL routines:ssl_choose_client_version:unsupported protocol error would be thrown if the SQL Server server does not support TLS 1.2.
In Node, it is possible to change the default setting by using the command line flag --tls-min-v1.0
when starting node. Since NW does not have a way to pass a command line flag to the Node context, the solution is to set a custom cryptoCredentialsDetails
option in the connection configuration that specifies minVersion: 'TLSv1'
, like the following:
mssql.connect({
user: "this.user",
password: "this.password",
server: "this.server",
database: "this.database",
options: {
cryptoCredentialsDetails: {
minVersion: 'TLSv1'
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With