Closed dvf3101 closed 4 years ago
Hm, that's interesting that it is working with axios
directly. It looks like the error is coming from the proxy. Will you try using this method of configuring the proxy and let me know what your results are? You will need to add this configuration both to the constructor and the authenticator.
Hi,
we have used the method of configuring the proxy, but the error is the same. Following the code:
const tunnel = require("tunnel");
let DiscoveryV1 = require('ibm-watson/discovery/v1');
const {
IamAuthenticator
} = require('ibm-watson/auth');
console.log('start')
const discovery = new DiscoveryV1({
version: '2019-04-30',
authenticator: new IamAuthenticator({
apikey: '******'
}),
proxy: false,
httpsAgent: tunnel.httpsOverHttp({
proxy: {
host: "proxy.online.*****.net",
port: 8080
}
}),
url: 'https://gateway-fra.watsonplatform.net/discovery/api'
});
var env = "*****";
var col = "*****";
async function run() {
try {
let collection = await discovery.getCollection({
environmentId: env,
collectionId: col
})
console.log(collection)
} catch (e) {
console.log(e)
}
}
run()
Following the error:
{ Error: write EPROTO 140169508251520: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/testDiscovery/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:208:21) at /home/Mauden01/workspace/script_upload/upload_doc_js/testDiscovery/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 140169508251520: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.' }
From some analysis, we have seen that in the classes typescript of different services (for example Discovery and Assistant), we have not found any params called httpsAgent and proxy. The library version is "ibm-watson": "^5.1.0". Could it be this the problem?
Thanks
That is not problem, httpsAgent
is an axios
parameter that gets passed straight to axios
. The issue may be that the httpsAgent
also needs to be passed to the IamAuthenticator
, since the authenticator is also making a request (for a token).
const httpsAgent = tunnel.httpsOverHttp({
proxy: {
host: "proxy.online.*****.net",
port: 8080
}
});
const discovery = new DiscoveryV1({
version: '2019-04-30',
authenticator: new IamAuthenticator({
apikey: '******',
httpsAgent,
}),
proxy: false,
httpsAgent,
url: 'https://gateway-fra.watsonplatform.net/discovery/api'
});
Hi,
we passed the httpsAgent to the IamAuthenticator, how you have written in your code and now we receive the following error:
{ Error: write EPROTO 139755673397120: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/testDiscovery/node_modules/ibm-cloud-sdk-core/lib/request-wrapper.js:208:21) at /home/Mauden01/workspace/script_upload/upload_doc_js/testDiscovery/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 139755673397120: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.' }
How can we solve it?
Thanks
Hello everyone, do you have any update about this Issue?
Regarding the error message you are getting, I found this post that says:
This error usually occurs if you attempt to connect to something that isn't using SSL/TLS. A wireshark trace might help you identify what is going on.
Given that you are using a proxy, I guess there are three possible sources of the error:
As I look over the notes above, this jumps out:
echo "$http_proxy" http://proxy.online.***.net:8080/
echo "$https_proxy" http://proxy.online.***.net:8080/
This looks to me like the http and https proxy are both set to the same endpoint, and I really don't think that's possible -- that one endpoint serves both. So I think the proxy configuration is somehow not right.
Hi,
thanks for your comment. Unfortunately we are not the VM's owner, so we will report your comment to the owner.
We will reply here as soon as we have an answer.
Thanks
Hi,
our customer is doing some check on VM. Instead is it possible that the error is generated by token service or Discovery? Could we verify this?
Thanks
The error is likely not generated by the token service or Discovery, because a connection is never being established with the server. The request is dropping for some reason, likely due to what Mike mentioned in his comment.
Hi,
thanks for your response. We are planning some changes to the proxy configuration in the next days. We will update you.
Thanks
Hi,
your response has resolved the error and now the service works properly. Our customer has modified the proxy configuration.
Thanks
@dvf3101 - Maybe this is an old post, but we are seeing this issue in our server. Just wondering on the proxy configuration. The changes that you did, is it on the server hosting the code or is it the proxy server?
while installing angular cli
sudo npm install -g @angular/cli
getting this error in ubuntu16.04
npm ERR! code EPROTO npm ERR! errno EPROTO npm ERR! request to https://registry.npmjs.org/@angular%2fcli failed, reason: write EPROTO 139787522484032:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332: npm ERR!
npm ERR! A complete log of this run can be found in: npm ERR! /home/madan/.npm/_logs/2021-10-27T12_08_12_340Z-debug.log
o(╥﹏╥)o,I also encountered this problem,Has this error been resolved, please help me
PS E:\_IdeaProject\fork\renren-ui-master> npm install
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://registry.npmmirror.com/semver failed, reason: write EPROTO 2924:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:332:
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ALF\AppData\Roaming\npm-cache\_logs\2022-08-17T11_26_57_896Z-debug.log
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:
To understand if the problem was inherent with the environment, we have tried the following simple code, but returns the same error:
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:
We have done the same test with Axios library and it works properly on the VM:
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:
Thanks