mirror of https://github.com/grpc/grpc-node.git
Fixed connectivity to Google PubSub over proxy
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)}`);
}
}
This commit is contained in:
parent
2111c0ffa9
commit
c536178c67
|
|
@ -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)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue