Socket Hangup Error when connecting Oracle NoSQL kvstore

130 views Asked by At

I had an issue in nodejs, when I use the API link https://hostname:8089

  return new NoSQLClient({

                serviceType: ServiceType.KVSTORE,

                endpoint: 'localhost:8089'

            });

I'm getting error like this,

Error: [REQUEST_TIMEOUT] Operation timed out after 10000 ms and 6 retries; Caused by: [NETWORK_ERROR] Network error; Caused by: socket hang up

2

There are 2 answers

1
Surendar Ramaraj On

There is nothing wrong with the query, it's about the port, you have to expose the port first and then try it...or disable the firewall

5
Dario On

This error happens when you are trying to access a secure KVStore using a non-secure connection call ( http://localhost:8089 )

NoSQLTimeoutError: [REQUEST_TIMEOUT] Operation timed out after 10000 ms 
and 6 retries; Caused by: [NETWORK_ERROR] Network error; 
Caused by: socket hang up

When accessing a secure KVstore, you need also to provide a user/pwd. If not, you will have the following error

NoSQLArgumentError: [ILLEGAL_ARGUMENT] TABLE_REQUEST: Illegal Argument:
Missing authentication information

Here is an example of a connection string (see https, if this value is not set you will use http by default):

return new NoSQLClient({
    serviceType: ServiceType.KVSTORE,
    endpoint: 'https://localhost:8089'
   , auth: {
        kvstore: {
            user: "driver_user",
            password: "DriverPass@@123"
        }
    }
});

In a secure mode, the proxy requires an SSL Certificate and private key. You need to provide the certificate, before running your application, set the environment variable NODE_EXTRA_CA_CERTS

export NODE_EXTRA_CA_CERTS=<yourpath>/certificate.pem

Without the certificate, you will have the following error:

NoSQLAuthorizationError: [REQUEST_TIMEOUT] Authorization error: 
[operation timeout]: Failed to login to kvstore.  
Operation timed out, see the cause

You also need to validate the requested domain name to match the server's certificate.

$ curl --cacert ~/certificate.pem  https://localhost:8089
curl: (51) Unable to communicate securely with peer: requested domain name
does not match the server's certificate.

In this case, you need to change the certificate or use the appropriate URL

$ openssl x509 -text -noout -in ~/certificate.pem | grep CN
        Issuer: CN=kvlite
        Subject: CN=kvlite

$ curl --cacert ~/certificate.pem  https://kvlite:8080

If your CN is not localhost, use an url matching with the certificate (e.g.)

return new NoSQLClient({
    serviceType: ServiceType.KVSTORE,
    endpoint: 'https://kvlite:8089'
   , auth: {
        kvstore: {
            user: "driver_user",
            password: "DriverPass@@123"
        }
    }
});