diff --git a/packages/grpc-js/src/transport.ts b/packages/grpc-js/src/transport.ts index 18d83cbfe..49ec01ddc 100644 --- a/packages/grpc-js/src/transport.ts +++ b/packages/grpc-js/src/transport.ts @@ -426,6 +426,10 @@ class Http2Transport implements Transport { try { this.session!.ping( (err: Error | null, duration: number, payload: Buffer) => { + if (err) { + this.keepaliveTrace('Ping failed with error ' + err.message); + this.handleDisconnect(); + } this.keepaliveTrace('Received ping response'); this.clearKeepaliveTimeout(); this.maybeStartKeepalivePingTimer();