Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP/hana-client library for node.js only works when user is logged in

OscarMG
Discoverer
0 Kudos
387
I have a web server set up with node.js and express. I use the sap/hana-client library for node.js to respond to requests by making queries.

This is a part of the code...


const hana = require('@sap/hana-client'); var connOptions = { serverNode: '', UID: '', PWD: '', ssValidateCertificate: 'true', }; const server = express(); ....etc

The code runs as a windows process. Everything works perfectly while the user who owns the process is logged in.

If I close the user's session, the process continues working, listening to requests and making queries to SAP, but it returns this error:

Error: Connection failed (RTE:[1000013] The system cannot find the file specified.

If I log in to the server again with that user, it already makes the requests correctly.

I don't know if the user is not logged in and is trying to search for certificates or something.

Thanks!

4 REPLIES 4

Vitaliy-R
Developer Advocate
Developer Advocate
0 Kudos
305

So, what happens when you change `ssValidateCertificate: 'true'` to 'false'? I would assume this is where it is looking for a file with certificates.

0 Kudos
275
Hello, thank you very much for the answering.
I have done some tests changing the connection parameters...
 
*** User logged in and this connection parameters ***
connOptions.ssValidateCertificate = 'false';
connOptions.encrypt = 'false';
Returns....
{
"code": -10709,
"sqlState": "HY000"
}
 
*** User logged in and this connection parameters ***
connOptions.ssValidateCertificate = 'true';
connOptions.encrypt = 'false';
 
Returns....
{
"code": -10709,
"sqlState": "HY000"
}
 
*** User logged in and this connection parameters ***
connOptions.ssValidateCertificate = 'false';
connOptions.encrypt = 'true';
 
Returns....
[
{
"LOTE": "ok",
"MATERIAL": "ok"
}
]
 
*** User logged in and this connection parameters ***
connOptions.ssValidateCertificate = 'true';
connOptions.encrypt = 'true';
 
Returns....
[
{
"LOTE": "ok",
"MATERIAL": "ok"
}
]
 
*** User not logged in ***
In all cases, when the user is not logged in, it returns the same error.
Error: Connection failed (RTE:[1000013] The system cannot find the file specified.

265
 

I have tried another library, SAP/node-hdb: SAP HANA Database Client for Node, and to my surprise with the same configuration it does work with the user logged in and not logged in. I'll leave this one. Thank you very much for the reply.

 

Vitaliy-R
Developer Advocate
Developer Advocate
0 Kudos
193

Oh, if you are using SAP HANA Cloud database, then it supports encrypted connections only, so `connOptions.encrypt = 'false';` should not allow a connection to be established.