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.
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.