tedious: not able to connect to Microsoft Fabric

Software versions

  • Tedious: 16.2.0
  • SQL Server: Microsoft Fabric(12.0.2000.8)
  • Node.js:18.17.0

Additional Libraries Used and Versions

node-mssql: 9.1.1

Table schema

Connection configuration const sqlConfig = { database: 'Root Data Warehouse', server: 'gextrl4zm6culiitwxjyp6ss5y-vh3r3oacuziunk6ffxzgvl2tay.datawarehouse.pbidedicated.windows.net', port: 1433, pool: { max: 10, min: 0, idleTimeoutMillis: 30000 }, options: { encrypt: true, // for azure trustServerCertificate: true// change to true for local dev / self-signed certs }, authentication: { type: 'azure-active-directory-service-principal-secret', options: { clientId: '74329c3d-6630-40f2-bbb6-ecb70659f0b2', clientSecret: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', tenantId: 'af382f31-6799-4585-a113-b5d387fa52ee' } }, };

Problem description

Got an error message when connecting to Microsoft Fabric Uncaught ConnectionError Error: Connection lost - read ECONNRESET

Expected behavior

Microsoft Fabric should be connected by service principal, query should work after the connection is established.

Actual behavior

It doesn’t connect at all.

Error message/stack trace

Uncaught ConnectionError Error: Connection lost - read ECONNRESET at socketError (c:\test\fabric\node_modules\tedious\lib\connection.js:1410:26) at <anonymous> (c:\test\fabric\node_modules\tedious\lib\connection.js:1160:16) at emit (events:526:35) at emitErrorNT (internal/streams/destroy:151:8) at emitErrorCloseNT (internal/streams/destroy:116:3) at processTicksAndRejections (internal/process/task_queues:82:21) — TickObject — at init (internal/inspector_async_hook:25:19) at emitInitNative (internal/async_hooks:202:43) at emitInitScript (internal/async_hooks:504:3) at nextTick (internal/process/task_queues:132:5) at onDestroy (internal/streams/destroy:103:15) at Socket._destroy (net:812:5) at _destroy (internal/streams/destroy:109:10) at destroy (internal/streams/destroy:71:5) at onStreamRead (internal/stream_base_commons:217:12) at callbackTrampoline (internal/async_hooks:130:17) — TCPWRAP — at init (internal/inspector_async_hook:25:19) at emitInitNative (internal/async_hooks:202:43) at Socket.connect (net:1176:7) at connect (net:244:17) at <anonymous> (c:\test\fabric\node_modules\tedious\lib\connector.js:102:37) at connectInSequence (c:\test\fabric\node_modules\tedious\lib\connector.js:101:20) — await — at connectOnPort (c:\test\fabric\node_modules\tedious\lib\connection.js:1157:5) at initialiseConnection (c:\test\fabric\node_modules\tedious\lib\connection.js:1072:19) at enter (c:\test\fabric\node_modules\tedious\lib\connection.js:2364:12) at transitionTo (c:\test\fabric\node_modules\tedious\lib\connection.js:1365:24) at reconnect (c:\test\fabric\node_modules\tedious\lib\connection.js:2468:14) at dispatchEvent (c:\test\fabric\node_modules\tedious\lib\connection.js:1391:15) at socketClose (c:\test\fabric\node_modules\tedious\lib\connection.js:1439:12) at <anonymous> (c:\test\fabric\node_modules\tedious\lib\connection.js:1163:16) at emit (events:526:35) at <anonymous> (net:323:12) at callbackTrampoline (internal/async_hooks:130:17) — TCPWRAP — at init (internal/inspector_async_hook:25:19) at emitInitNative (internal/async_hooks:202:43) at Socket.connect (net:1176:7) at connect (net:244:17) at <anonymous> (c:\test\fabric\node_modules\tedious\lib\connector.js:102:37) at connectInSequence (c:\test\fabric\node_modules\tedious\lib\connector.js:101:20) — await — at connectOnPort (c:\test\fabric\node_modules\tedious\lib\connection.js:1157:5) at initialiseConnection (c:\test\fabric\node_modules\tedious\lib\connection.js:1072:19) at enter (c:\test\fabric\node_modules\tedious\lib\connection.js:2364:12) at transitionTo (c:\test\fabric\node_modules\tedious\lib\connection.js:1365:24) at connect (c:\test\fabric\node_modules\tedious\lib\connection.js:1035:10) at <anonymous> (c:\test\fabric\ted.js:30:12) at Module._compile (internal/modules/cjs/loader:1256:14) at Module._extensions…js (internal/modules/cjs/loader:1310:10) at Module.load (internal/modules/cjs/loader:1119:32) at Module._load (internal/modules/cjs/loader:960:12) at executeUserEntryPoint (internal/modules/run_main:81:12) at <anonymous> (internal/main/run_main_module:23:47) Any other details that can be helpful

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 31 (7 by maintainers)

Most upvoted comments

Hello can we please get someone to merge this PR in? I have tested it thoroughly myself and can confirm it works well. https://github.com/hightouchio/node-mssql

The PR is 1668 (https://github.com/tediousjs/tedious/pull/1668).

THANK YOU!

Any updates as to when this might get merged?

Hi @cjcarpenter1 ! Haven’t had the chance to fix the build issues that are stopping me form merging the fix into the library. The changes I made to the login7 payload are causing the build failures, but I don’t know what is specifically the problem. For the time being, I’ve being using a forked version of the node-mssql library that has my Tedious changes in my project. Feel free to use this if you want to get a connection going, but beware that it has not been tested against anything other than a current Fabric instance (no idea if it works with old versions of SQLServer).

Hi @SanderBlom, we did some investigation and unfortunately that tedious does not currently support connection to Microsoft Fabric DW. Microsoft Fabric DW has a bit more restricted way for handling incoming connection compare to how tedious currently handles it internally. The team will have a discussion and see when we will have the bandwidth to get this working.

@AlejandroFerrera, the other mssql node client msnodesqlv8 uses the ODBC driver under the hood. Using it, I manage to connect from our node backend to Fabric Lakehouse SQL endpoints. If you own the code connecting Fabric, switching client may be a viable option.

Unfortunately it’s not for us since we also use third party libraries that depend on the native Javascript driver 😦

Just tested it today and it looks like it no longer works - I would guess it’s likely due to the new TDS version from 11/19. Will take a look at this week and try to get to the bottom of what broke.

Indeed, I did a quick test and got a ESOCKET ConnectionError

Hi @SwadX, Thanks for the detail log. Will look into this a bit more, see if we can figure out why it behave like this.