Unsupported Protocol Error
See original GitHub issueI am seeing the below error when trying to connect to a local sql server database using tedious. I have tried both using the IP address and localhost and it won’t connect. TCP/IP is enabled for MSSQLSERVER in sql server configuration manager. I also verified that sql server browser is also running.
Error:
ConnectionError: Failed to connect to 127.0.0.1:1433 - 22996:error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol:c:\ws\deps\openssl\openssl\ssl\statem\statem_lib.c:1942:
at ConnectionError (E:\ExpressServer\kagetruckroutingappServer\node_modules\tedious\lib\errors.js:13:12)
at Connection.socketError (E:\ExpressServer\kagetruckroutingappServer\node_modules\tedious\lib\connection.js:1641:56)
at Socket.<anonymous> (E:\ExpressServer\kagetruckroutingappServer\node_modules\tedious\lib\connection.js:1405:14)
at Socket.emit (events.js:326:22)
at emitErrorNT (internal/streams/destroy.js:100:8)
at emitErrorCloseNT (internal/streams/destroy.js:68:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: ‘ESOCKET’
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! kagetruckroutingappserver@0.0.0 start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kagetruckroutingappserver@0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! Redacted
Code:
var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
console.log('start')
var config = {
server: 'localhost',
authentication: {
type: 'default',
options: {
userName: 'redacted', // update me
password: 'redacted' // update me
},
options: {
encrypt: false,
cryptoCredentialsDetails: {
minVersion: 'TLSv1'
}
}
}
}
var connection = new Connection(config);
console.log('after connection variable')
connection.connect();
console.log('after connect')
connection.on('connect', function(err) {
if (err) {
console.log('Connection Failed');
throw err;
}
// If no error, then good to proceed.
console.log("Connected");
});
Issue Analytics
- State:
- Created 2 years ago
- Comments:25 (7 by maintainers)

Top Related StackOverflow Question
Hey, i already resolve the issue, adding the suggested option i get another error but i realize that the error was that i was using the user of windows authentication instead of an sql server user, thank you
Try adding this options:
options: { trustServerCertificate: true
}