IBM/node-sdk-core

EPROTO 140502679459712:error:1408F10B:SSL routines:ssl3_get_record:wrong version number- Response not received - no connection was made to the service.

dvf3101 opened this issue · 0 comments

Hi,

we have done the migration of Watson service and the consequent update of the library ibm-watson.

After the update our script doesn't work properly and returns the following error:

{ Error: write EPROTO 140502679459712:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:

at RequestWrapper.formatError (/home/Mauden01/workspace/script_upload/upload_doc_js/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:208:21)
at /home/Mauden01/workspace/script_upload/upload_doc_js/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:196:25
at process._tickCallback (internal/process/next_tick.js:68:7)

message:
'write EPROTO 140502679459712:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:\n',
statusText: 'EPROTO',
body:
'Response not received - no connection was made to the service.' }

To understand if the problem was inherent with the environment, we have tried the following simple code, but returns the same error:

var DiscoveryV1 = require('ibm-watson/discovery/v1');
const { IamAuthenticator } = require('ibm-watson/auth');

const discovery = new DiscoveryV1({
    version: '2019-04-30',
    authenticator: new IamAuthenticator({
        apikey: '*************',
    }),
    url: '*************'
});

discovery.getCollection({
    environmentId: "********",
    collectionId: "********",
}).then(collection => {
    console.log('collection', collection)
}).catch(err => {
    console.log('---------------- ERROR GETCOLLECTION:', err)
})

We have tried the same code in local and works properly.

Another test done consists in the use of request library on the VM. Following the code:

const request = require('request');

var env = "********";
var col = "********";
var document_id = "1234"

request.get(`https://gateway-fra.watsonplatform.net/discovery/api/v1/environments/${env}/collections/${col}/documents/${document_id}`, {
    qs: {
        version: '2019-04-30'
    },
    auth: {
        user: 'apikey',
        pass: '************',
        sendImmediately: false
    },
    json: true
}, function (err, data) {
    if(err){
        console.log('err', err)
    }else{
        console.log('data',data)
    }
});

We have done the same test with Axios library and it works properly on the VM:

const axios = require("axios")

var environment_id = "**********";
var collection_id = "***********";
const {
    IamAuthenticator
} = require('ibm-watson/auth');

async function run() {
    try {
        let response = await axios({
            url: `https://gateway-fra.watsonplatform.net/discovery/api/v1/enviro                                                                                                                                                                                                nments/${environment_id}/collections/${collection_id}?version=2019-04-30`,
            auth: {
                username: 'apikey',
                password: '************'
            },
        })
        console.log(response.data);
    } catch (e) {
        console.log(e.message)
    }
}

run()

Request and Axios library work properly on the VM.
So from this tests, we think that the problem is between the setting on the VM and the ibm-watson library.

Following some info of the VM where we run the code:

cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

node -v
v10.2.0

npm --versions
{ upload_doc_js: '1.0.0',
npm: '5.6.0',
ares: '1.14.0',
cldr: '33.0',
http_parser: '2.8.0',
icu: '61.1',
modules: '64',
napi: '3',
nghttp2: '1.29.0',
node: '10.2.0',
openssl: '1.1.0h',
tz: '2018c',
unicode: '10.0',
uv: '1.20.3',
v8: '6.6.346.32-node.8',
zlib: '1.2.11' }

openssl version
OpenSSL 1.0.2k-fips 26 Jan 2017

echo "$http_proxy"
http://proxy.online.***.net:8080/

echo "$https_proxy"
http://proxy.online.***.net:8080/

Thanks