Search code examples
node.jshanasap-business-application-studio

Connecting to SAP HANA database via Node.js


I'm trying to connect with the HANA database using Node.js but I'm stuck due to this error:

Error: Connection failed (RTE:[300015] SSL certificate validation failed: error code: 337047686, file:../ssl/statem/statem_clnt.c, line:1914 - error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

This is the connection script:

const hana = require('@sap/hana-client');


const conn_params = {
    host : 'e82df3f2-da37-42a9-9378-ea7cac35e2c1.hana.trial-us10.hanacloud.ondemand.com',
    port : '443',
    uid: 'DBM_HDI_DB_1_1LU2VD9D5CJ82CA8OLZ4INFY2_RT',
    pwd: 'Lc2Fdl-XPX_Cim84O4-Pduqy.3ptUQ-8I2qXdsY_YRlBLUckgvDNEqEYyUNKAhqSrbpT0soGQNBiEZJUMKY3t2riRjuk-MhbdxiHqQG2NHnZuo7LY5TJagIBWKaYVg4S'
};

const conn = hana.createConnection();

conn.connect(conn_params)

module.exports = conn

PS : I'm coding on SAP Business Application Studio I also double checked my HANA instance it's running and I tried restarting it.


Solution

  • Sounds like there is an issue with your SSL certificate. The corresponding connection parameters for setting up SSL can be found in the documentation of the Node.js client of SAP HANA.

    Note, that there is a property sslValidateCertificate, which you can set to false to disable validation of SSL certificates for testing purpose.