nodejs-dialogflow icon indicating copy to clipboard operation
nodejs-dialogflow copied to clipboard

SSL error when trying to run example

Open pedro-bralv opened this issue 8 years ago • 3 comments

Environment details

  • OS: Windows 10
  • Node.js version: 10.1.0
  • npm version: 5.0.3
  • dialogflow version: 0.4.0

Steps to reproduce

  1. Follow the QuickStart steps on https://github.com/dialogflow/dialogflow-nodejs-client-v2
  2. Create a file using the code on https://github.com/dialogflow/dialogflow-nodejs-client-v2#using-the-client-library
  3. Change the project ID as intended.
  4. Run node filename.js

After struggling with the grpc installation, I followed the steps for Windows users here. Now I have the following error when trying to run the code, as well as with any sample on the /samples directory:

Auth error:Error: write EPROTO 21584:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252:
ERROR: { Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: write EPROTO 
21584:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\ssl\record\ssl3_record.c:252:
at Object.exports.createStatusError (C:\Users\foo\Desktop\dialogflow\samples\node_modules\grpc\src\common.js:87:15)
at Object.onReceiveStatus (C:\Users\foo\Desktop\dialogflow\samples\node_modules\grpc\src\client_interceptors.js:1214:28)
at InterceptingListener._callNext (C:\Users\foo\Desktop\dialogflow\samples\node_modules\grpc\src\client_interceptors.js:590:42)
at InterceptingListener.onReceiveStatus (C:\Users\foo\Desktop\dialogflow\samples\node_modules\grpc\src\client_interceptors.js:640:8)
at callback (C:\Users\foo\Desktop\dialogflow\samples\node_modules\grpc\src\client_interceptors.js:867:24)
code: 14,
metadata: Metadata { _internal_repr: {} },
details: 'Getting metadata from plugin failed with error: write EPROTO 21584:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:openssl\\ssl\\record\\ssl3_record.c:252:\n' }

I searched for problems with SSL relating to both grpc and Google cloud projects, but didn't find any clue on what to do. For me it seems to be related to the installation issues involving openssl and Windows as cited on the grpc installation page, so I'm considering test the same steps on some Linux platform and see if the same problem occurs.

Could anyone help?

Update:

Running on an Ubuntu VM with Node.js: 8.11.2 npm: 5.6.0

I got a similar error, here tried to run detect.js from /samples:

ubuntu@ubuntu-VirtualBox:~/dialogflow-nodejs-client-v2/samples$ node detect.js text -q "hi"
Sending query "hi"
E0523 16:58:36.419127299   10093 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0523 16:58:36.774246703   10093 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0523 16:58:37.124691019   10093 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0523 16:58:37.471887273   10093 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0523 16:58:38.195687058   10093 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.
E0523 16:58:38.542390862   10093 ssl_transport_security.cc:989] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number.

Also I'm pretty sure the problem isn't with my credentials, because they work perfectly fine with the Python SDK.

pedro-bralv avatar May 23 '18 17:05 pedro-bralv

I found out that the problem was my proxy, when I tried to use in a network without the proxy I forgot to deactivate the proxy configurations temporarily.

pedro-bralv avatar May 28 '18 18:05 pedro-bralv

This is not an issue with the proxy from what I can tell. This issue appears to be with the node.js library itself. The TLS handshake needs to be initiated with an HTTP CONNECT message to the proxy so the destination server (google) can receive the TLS handshake initiation instead of your proxy. Otherwise you get a 400 or other error from your proxy server, which is invalid TLS protocol with respect to your client, resulting in the error. If the node.js grpc implementation really did send the CONNECT message to the proxy, then this all should work.

mephicide avatar Jul 23 '18 13:07 mephicide

Greetings! We're tracking proxy support over in #20.

JustinBeckwith avatar Sep 20 '18 01:09 JustinBeckwith