I am trying to connect to a SQL DB SERVER with the help of mssql . I am able to connect to the DB server when the code is running on my local windows machine. But this is not working on my Linux server , its not connecting to DB.
I should be able to connect to SQL DB SERVER on Linux machine too.
I am getting the error as
src/node_modules/tedious/lib/connection.js: 2423 throw err
Error: error:00000000 : lib(0):func(0):reason(0) at new Hmac(node: internal/crypto/hash:136:17) at Object.createHmac (node: crypto:165:10)
Configuration:
const sqlConfig = {
user: process.env.DB_USER,
password: process.env.DB_PWD,
database: process.env.DB_NAME,
domain: process.env.Domain,
server: process.env.server,
port: process.env.port
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 30000
},
options: {
encrypt: true, // for azure
trustServerCertificate: true // change to true for local dev / self-signed certs
}
}
async () => {
try {
await sql.connect(sqlConfig)
const result = await sql.query`select * from mytable where id = ${value}`
console.log(result)
} catch (err) {
console.log(error)
}
}
Software versions NodeJS: 18.17.1 node-mssql: 10.0.2 SQL Server: 2019
Note: This was working with the below configuration and it started failing when updated to above mentioned configuration
Software versions NodeJS: 16.15.0 node-mssql: 4.3.7 SQL Server: 2019
If you are able to connect via local computer but not on the Linux machine it could be the URI is invalid, or the database port is not open for you to connect to it.