3

I am trying to get Dialogflow SDK samples from Google's Dialogflow v2 Node.js SDK to work. I am using node.js v8.10.0, with dialogflow node.js SDK version 0.5.0. I am encountering this issue when trying to run the "Detect Intent" sample, from behind a corporate http/s proxy:

Auth error:Error: write EPROTO 140163148314432:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:827

I came across this post here: https://medium.com/google-cloud/accessing-google-cloud-apis-though-a-proxy-fe46658b5f2a which seemed very java-oriented, but it suggested that the environment variable GRPC_PROXY_EXP be set in order to get the gRPC calls to work behind a proxy. I set the environment variable in the shell from which I was running node with export GRPC_PROXY_EXP="$https_proxy" and attempted to run the sample again, with the same issue. Note that my $http_proxy, $https_proxy variables are the same.

The same sample works from the same machine, when connected to a wifi network without the proxy; and a tcpdump packet analysis indicates that there are two TCP connections (distinct ports) in-use: one which works (and is opened first), and one which doesn't, and encounters the error with the proxy. The second connection immediately begins the CLIENT_HELLO TLS message, when it needs to first authenticate and send the HTTPS proxy the CONNECT message (as the first TCP connection does).

Am I missing something, or is this an issue with the dialogflow (google-gax / grpc) node library?

Prisoner
  • 49,922
  • 7
  • 53
  • 105
mephicidex
  • 41
  • 4

1 Answers1

1

After some back-and-forth on a couple of Google node project issue discussion boards, the problem turned out to be that - when HTTPS over HTTP tunneling is used - the gtoken API's direct use of the axios npm package was only prepared to use HTTPS (consistent with the protocol in the URL).

To make a long story short; Dialogflow 0.8.2 contains the fix for this issue in that its transitive dependencies include a version of the gtoken package that uses gaxios instead of axios. gaxios is a package used elsewhere in the google-gax library to make HTTP/S connections (which is proxy aware, and handles the HTTPS over HTTP use-case).

mephicidex
  • 41
  • 4