Skip to content

Commit

Permalink
Fixed connectivity to Google PubSub over proxy
Browse files Browse the repository at this point in the history
Latest version has caused @google-cloud/pubsub fail to connect over a proxy connection.


Snapshot of error:

2020-08-29T10:52:45.340Z | proxy | Successfully connected to pubsub.googleapis.c
om:443 through proxy 172.16.52.252:443
2020-08-29T10:52:45.370Z | subchannel | 172.16.52.252:443 CONNECTING -> TRANSIEN
T_FAILURE
2020-08-29T10:52:45.372Z | pick_first | CONNECTING -> TRANSIENT_FAILURE
2020-08-29T10:52:45.373Z | resolving_load_balancer | dns:172.16.52.252:443 CONNE
CTING -> TRANSIENT_FAILURE
2020-08-29T10:52:45.375Z | channel | Pick result: TRANSIENT_FAILURE subchannel:
undefined status: 14 No connection established
2020-08-29T10:52:45.377Z | call_stream | [11] cancelWithStatus code: 14 details:
 "No connection established"
2020-08-29T10:52:45.379Z | call_stream | [11] ended with status: code=14 details
="No connection established"
2020-08-29T10:52:45.381Z | connectivity_state | dns:172.16.52.252:443 CONNECTING
 -> TRANSIENT_FAILURE


Before proposed fix:

    static getDefaultAuthority(target) {
        return target.path;  // this returns "pubsub.googleapis.com:443"
    }

After proposed fix:

    static getDefaultAuthority(target) {
        const hostPort = uri_parser_1.splitHostPort(target.path);  // target.path is "pubsub.googleapis.com:443"
        if (hostPort !== null) {
            return hostPort.host; // this returns "pubsub.googleapis.com"
        }
        else {
            throw new Error(`Failed to parse target ${uri_parser_1.uriToString(target)}`);
        }
    }
  • Loading branch information
wkchee committed Aug 29, 2020
1 parent 2111c0f commit c536178
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/grpc-js/src/resolver-dns.ts
Expand Up @@ -268,7 +268,13 @@ class DnsResolver implements Resolver {
* @param target
*/
static getDefaultAuthority(target: GrpcUri): string {
return target.path;
const hostPort = uri_parser_1.splitHostPort(target.path);
if (hostPort !== null) {
return hostPort.host;
}
else {
throw new Error(`Failed to parse target ${uri_parser_1.uriToString(target)}`);
}
}
}

Expand Down

0 comments on commit c536178

Please sign in to comment.