NodeJS connect to SQL Server getaddrinfo ENOTFOUNT

I’m trying to connect to a Microsoft SQL Server using Knex.js, but I’m getting getaddrinfo ENOTFOUND. I’m aware that this is an indication, that NodeJS is unable to resolve the address, often through DNS or protocol problems.

const knex = require('knex')({
    client: 'mssql',
    connection: {
        server: 'filesrv\docx',  // backslash in string needs to be escaped
        user: 'user',             // changed for privacy reasons
        password: 'secret',       // changed for privacy reasons
        options: {
            port: 1433,
            database: 'DX_Matching_DB'
        }
    }
});

UnhandledPromiseRejectionWarning: ConnectionError: Failed to connect to filesrvdocx:1433 – getaddrinfo ENOTFOUND filesrvdocx

at ConnectionError(.node_modulestediousliberrors.js:13:12)
at Connection.socketError(.node_modulestedious libconnection.js:1664:56)

SQL Server in SQL Server Object Explorer:

SQL Server in SQL Server Object Explorer

App is run on Windows. Resolve-DnsName is able to resolve filesrvdocx. No change when exchanging filesrv for the corresponding IP.

Answer

The knex configuration object uses the instance name inside the options, e.g.:

const knex = require('knex')({
    client: 'mssql',
    connection: {
        server: 'filesrv',
        user: 'user',
        password: 'secret',
        options: {
            database: 'DX_Matching_DB',
            instanceName: 'docx'
        }
    }
});