0

I have a hybrid connection to on-premise MSSQL server, I am trying to access this from a Node.js application.

The Node.js application was originally set up to connect to Azure DB, but the requirement has changed and now need to read data from an on-premise server.

I have used hybrid connections before but within a .net aspx applications.

The initial error I got from the application was

 { 
    ConnectionError: Failed to connect to SERVERNAME:1433 in 15000ms
    at ConnectionError (D:\home\site\wwwroot\node_modules\tedious\lib\errors.js:12:12)
    at Connection.connectTimeout (D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:944:28)
    at Timeout._onTimeout (D:\home\site\wwwroot\node_modules\tedious\lib\connection.js:913:16)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
    message: 'Failed to connect to SERVERNAME:1433 in 15000ms',
    code: 'ETIMEOUT' 
 }

So I did all the usual connection tests, checked SQL users and permissions etc.

Everything pointed to the hybrid connection but the relay was showing connected in both the Azure portal and the hybrid connection manager on the server.

So enabled the hybrid connection logging to see if that would give me more info.

HYBRIDCONNECTIVITY_LOGGING_ENABLED 1

Which threw the following error.

Hybrid Connection Exception encountered: None of the connected listeners accepted the connection within the allowed timeout.

Sadly I have no idea what this means, has anyone encountered the error above, searching the error brings back very little results.

I get the same error if I use SQLCMD from Azure, I have tried fully qualified server names, I have checked the ports that are required and firewall settings, if I close 443 https outbound the connector shows disconnected.

RickWeb
  • 1,765
  • 2
  • 25
  • 40
  • Smells of a firewall or DNS issue. Are you connecting to the default SQL Server instance or a named instance? – Mehdi Ibrahim Sep 05 '18 at 21:03
  • Default instance, yes my thoughts are the same, do you know if there is way to test DNS through hybrid connection, it resolves fine locally. Althought if it was DNS i would expect to see an "EndpointNotFoundException: The endpoint was not found. None of the connected listeners accepted the connection within the allowed timeout." instead. – RickWeb Sep 05 '18 at 21:37
  • You will find this resource handy: https://blogs.msdn.microsoft.com/waws/2017/06/30/things-you-should-know-web-apps-and-hybrid-connections/ – Mehdi Ibrahim Sep 05 '18 at 22:02
  • That's a really good document, I came foul of the time issue a few years back when a hyper-v machine time was becoming out of sync very slowly. I think i have found the course of the issues though it defiantly a firewall / connection issue, as I have VPN'ed the server to a clean connection and no issues. It bizarre how the its showing connected though the portal and manager, I am going to get TCP view out see if can see what's happening. – RickWeb Sep 07 '18 at 17:01

1 Answers1

0

Ok, I solved this a month ago, basically although the service bus address was white-listed, the hybrid connector spawns multiple connections to transmit data, so although handshaking and initial connection could communicate with Azure nothing else could, hence the time out. I ended up white listing the whole of azure region my relay was in. You can download all the azure data centre IP ranges here

I found the blog Mehdi Ibrahim pasted above very useful, in the past 12 months I have been hit by every issue in there.

RickWeb
  • 1,765
  • 2
  • 25
  • 40