oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

Error: NJS-510: connection to host ***.***.***.*** port **** timed out #1619

Closed Andrija-Markovic closed 8 months ago

Andrija-Markovic commented 8 months ago

Oracle DB Version: "Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.19.0.0.0" Nodejs Version: 16.4.0 OracleDB.versionString: 6.1.0 OracleDB.oracleClientVersionString: could not get it because I am running in Thin mode process.platform: win32 process.version: v16.4.0 process.arch: x64

package.json dependencies: "oracledb": "^6.1.0", "@types/oracledb": "^6.0.1",

Application Setup

I have an Expressjs app written in TypeScript running on Node. The application connects to an Oracle DB solely to read data from it. This is how the app creates the connection pool:

this.connPool= await OracleDB.createPool({
    user: config.DB_USER,
    password: config.DB_PWD,
    connectionString: config.DB_CONN
});

When a connection is needed the app does:

await this.connPool.getConnection();

And it also releases the connection when no longer needed by doing:

await conn.release();

Problem Description

When I am developing this app on my local machine, the connection and reading from the Oracle DB works just fine. However, I have the app deployed in an Azure App Service and when I try to read data from the Oracle DB via the deployed app, I get Error: NJS-510: connection to host ***.***.***.*** port **** timed out. Request exceeded \"transportConnectTimeout\" of 60 seconds. (CONNECTION_ID=*****************************).

I connected to the Oracle DB server via SQLDeveloper and checked if the Native Network Encryption is enabled and it looks like it's not. So, I should be able to use node-oracledb in Thin mode, right? image

Furthermore, I pinged the Oracle DB server from the bin/bash console of my App Service and the server is responding successfully.

Any ideas why I am getting the time out error when trying to do await this.connPool.getConnection()?

cjbj commented 8 months ago

Thanks for checking NNE - it won't be the problem you are seeing. The error is a more fundamental network problem in your configuration on Azure. Maybe the required network ports are not open or DNS is not working. Triple check the hostname in the connection string doesn't have a typo. I don't have any pearls of wisdom about Azure. Maybe some other follower of this repo can comment.

Andrija-Markovic commented 8 months ago

Thanks for the response @cjbj. Looks like you are correct. I talked to our networking guys and they think it's a firewall issue. The firewall issue should be resolved in two weeks and I will be able to confirm if that fixed it. Could we please leave this issue open until I confirm and document the resolution?

Andrija-Markovic commented 8 months ago

Our networking guys were able to make changes to the firewall earlier than their SLA. I can confirm that the time-out error that I was getting was due to a firewall rules.

For Azure users, here is my setup: I have a Linux App Service sitting inside of an ASEv3 (ASE handles all the vNet config) and App Service is talking to an Oracle DB server sitting on-prem behind a firewall.

sharadraju commented 8 months ago

Thanks Andrija for your inputs