最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to fix NJS-505: unable to initiate TLS connection. Please check if wallet credentials are valid in node-oracledb - Stack Ove

matteradmin3PV0评论

I have created an oracle wallet using orapki and imported truststore certificates into it. I have an RDS oracle database in AWS and when trying to connect to it using the oracle wallet I get this error:

[2024-11-07T13:31:04.692] [ERROR] oracleDBWrapper - Error: NJS-505: unable to initiate TLS connection. Please check if wallet credentials are valid
    at Object.throwErr (/home/node/node_modules/oracledb/lib/errors.js:603:10)
    at NTTCP.connect (/home/node/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:237:18)
    at async NetworkSession.transportConnect (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:173:5)
    at async NetworkSession.connect2 (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:211:7)
    at async NetworkSession.connect1 (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:314:23)
    at async NetworkSession.connect (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:530:5)
    at async ThinConnectionImpl.connect (/home/node/node_modules/oracledb/lib/thin/connection.js:628:5)
    at async ThinPoolImpl.bgThreadFunc (/home/node/node_modules/oracledb/lib/thin/pool.js:420:11) {
  code: 'NJS-505'
}

However using this same wallet and sqlplus I can connect fine so it seems the wallet is fine. On my local machine I added in some logging to ntTcp.js and checked the exact error is:

Error: error:0909006C:PEM routines:get_name:no start line
    at setKey (node:internal/tls/secure-context:92:11)
    at configSecureContext (node:internal/tls/secure-context:174:7)
    at Object.createSecureContext (node:_tls_common:121:3)
    at NTTCP.connect 

I have created an oracle wallet using orapki and imported truststore certificates into it. I have an RDS oracle database in AWS and when trying to connect to it using the oracle wallet I get this error:

[2024-11-07T13:31:04.692] [ERROR] oracleDBWrapper - Error: NJS-505: unable to initiate TLS connection. Please check if wallet credentials are valid
    at Object.throwErr (/home/node/node_modules/oracledb/lib/errors.js:603:10)
    at NTTCP.connect (/home/node/node_modules/oracledb/lib/thin/sqlnet/ntTcp.js:237:18)
    at async NetworkSession.transportConnect (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:173:5)
    at async NetworkSession.connect2 (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:211:7)
    at async NetworkSession.connect1 (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:314:23)
    at async NetworkSession.connect (/home/node/node_modules/oracledb/lib/thin/sqlnet/networkSession.js:530:5)
    at async ThinConnectionImpl.connect (/home/node/node_modules/oracledb/lib/thin/connection.js:628:5)
    at async ThinPoolImpl.bgThreadFunc (/home/node/node_modules/oracledb/lib/thin/pool.js:420:11) {
  code: 'NJS-505'
}

However using this same wallet and sqlplus I can connect fine so it seems the wallet is fine. On my local machine I added in some logging to ntTcp.js and checked the exact error is:

Error: error:0909006C:PEM routines:get_name:no start line
    at setKey (node:internal/tls/secure-context:92:11)
    at configSecureContext (node:internal/tls/secure-context:174:7)
    at Object.createSecureContext (node:_tls_common:121:3)
    at NTTCP.connect 
Share Improve this question asked Nov 18, 2024 at 12:21 morrrowgimorrrowgi 1701 gold badge5 silver badges11 bronze badges 2
  • Try Thick mode node-oracledb. – Christopher Jones Commented Nov 18, 2024 at 22:22
  • Using thick mode does fix the issue however I would prefer to be able to use thin mode as using thick mode means I need to include the oracle binaries with my node application and I am trying to avoid that if possible – morrrowgi Commented Dec 24, 2024 at 14:01
Add a comment  | 

1 Answer 1

Reset to default 0

Can you try adding the wallet by setting NODE_EXTRA_CA_CERTS. https://github/oracle/node-oracledb/issues/1593

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far