Lesson Learned #277: Failed to connect to xyz.database.windows.net:1433-Could not connect (sequence)

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

We got an issue when our customer using Node.Js they got the following error message: 

Failed to connect to xyz.database.windows.net:1433 - Could not connect (sequence)
at Connection.socketError (C:\...\tedious\lib\connection.js:1395:28)
at C:\...\tedious\lib\connection.js:1176:14
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
code: 'ESOCKET', isTransient: undefined }
RequestError: Requests can only be made in the LoggedIn state, not the Connecting state
at Connection.makeRequest (C:\...\tedious\lib\connection.js:2204:24)
at Connection.execSql (C:\...\tedious\lib\connection.js:1734:10)
at executeStatement (C:\...\NodeJsVsCode\ConnectTest.js:104:16)
at Connection.<anonymous> (C:\....\NodeJsVsCode\ConnectTest.js:81:5)
at Connection.emit (node:events:390:28)
at Connection.emit (C:\...\tedious\lib\connection.js:1040:18)
at Connection.socketError (C:\...\tedious\lib\connection.js:1395:12)
at C:\....\tedious\lib\connection.js:1176:14
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
code: 'EINVALIDSTATE', number: undefined, state: undefined, class: undefined, serverName: undefined, procName: undefined, lineNumber: undefined}

 

When we are connecting to Azure SQL Database we need to know that, depending on connectivity policy: proxy or redirect, we need to open as outbound (1433 for proxy) or (1433 and11000-12000 for redirect). See this link for more information. 

 

Also, remember that the DNS needs to adjusted for this, when we are connecting using proxy we need to resolve the IP of our server, for example, xyz.database.windows.net, but, using redirect connection policy we are going to connect directely to the Azure SQL node that the name will be different and needs to be resolved - Lesson Learned #216: Hands-On-Labs: How redirect connection policy type works - Microsoft Community Hub

 

Enjoy!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.