question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTTPS_PROXY with HTTP Proxy fail to connect

See original GitHub issue

Environment details

  • OS: all
  • Node.js version: 8.11.*
  • npm version: 5.6.0
  • @google-cloud/logging version: 4.1.1

Steps to reproduce

  1. Setup a http Proxy docker run --publish 3128:3128 sameersbn/squid:3.3.8-23

  2. Start a logging instance with HTTPS_PROXY env HTTPS_PROXY=http://proxy... node script.js

  3. try to log

const { Logging } = require('@google-cloud/logging');

if (process.env.GOOGLE_APPLICATION_CREDENTIALS) {
  const logging = new Logging({
    projectId: 'process.env.PROJECTID',
  });

  const logName = 'my-log';
  const log = logging.log(logName);


  const metadata = {
    resource: { type: 'global' },
  };

  const entry = log.entry(metadata, { logDate: Date.now() });
  log.info(entry, console.log);
};

Expected

Logging of the Logdata

Actual

Receiving Error:

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

{ Error: 14 UNAVAILABLE: Getting metadata from plugin failed with error: write EPROTO 4409435584:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:
    at Object.exports.createStatusError (/Users/name/source/project/node_modules/grpc/src/common.js:87:15)
    at Object.onReceiveStatus (/Users/name/source/project/node_modules/grpc/src/client_interceptors.js:1188:28)
    at InterceptingListener._callNext (/Users/name/source/project/node_modules/grpc/src/client_interceptors.js:564:42)
    at InterceptingListener.onReceiveStatus (/Users/name/source/project/node_modules/grpc/src/client_interceptors.js:614:8)
    at callback (/Users/name/source/project/node_modules/grpc/src/client_interceptors.js:841:24)

It seems that the Error is based in GRPC and there is no support for proxies.

The only alternative in my case is to use the REST API direct, but it is not recommended.

Similar issue but for axios: https://github.com/googleapis/nodejs-storage/issues/277

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ajaaymcommented, Feb 21, 2019

@refextu can you please try setting both env variable https_proxy & HTTPS_PROXY GRPC uses https_proxy and authentication which goes through normal node request uses HTTPS_PROXY. Its working fine for me following your steps, below is the log.

1550772966.261      1 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772966.277      0 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772966.787      0 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772968.293      0 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772968.298      0 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772968.302      0 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772968.811      0 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772970.322      0 172.17.0.1 TCP_MISS/503 0 CONNECT metadata.google.internal:443 - HIER_NONE/- -
1550772970.766    177 172.17.0.1 TCP_MISS/200 4704 CONNECT www.googleapis.com:443 - HIER_DIRECT/172.217.10.138 -
1550772971.031    540 172.17.0.1 TCP_MISS/200 4263 CONNECT logging.googleapis.com:443 - HIER_DIRECT/172.217.10.138 -

1reaction
refextucommented, Feb 21, 2019

@ajaaym I can confirm that this working as expected.

HTTPS_PROXY=http://localhost:3128 node script.js and https_proxy=http://localhost:3128 node script.js logs perfectly to google cloud

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Unable to Connect to the Proxy Server | VSS Guide
If you are still unable to connect to proxy server, you can clear the browser cache. Clearing browser cache will remove corrupt scripts...
Read more >
HTTPS Proxy connections fail with certificate_unknown error
Problem. Attempts to connect to an HTTPS SSL site via the Rational Integration Tester (RIT) HTTP Proxy fail. The Proxy log reports "Received ......
Read more >
Unable to connect through HTTPS proxy · Issue #330 - GitHub
If using an HTTPS Only proxy it will fail; This is because the server is attempting to use the proxy as an HTTP...
Read more >
Can't consume web services via an HTTP proxy server - .NET ...
This article provides a resolution to fix the error that occurs on a .NET client that consumes a Web service via an HTTP...
Read more >
Using HTTP Proxy Server Over SSL Fails with Error "Failed to ...
Symptoms. Seeing the following error when using the HTTP Proxy with HTTPS protocol: error "Failed to communicate with proxy: null/-1"
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found