From efc9a0f05c9e2dbbfe2758e6df8cb5527903cc9f Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Thu, 4 Mar 2021 16:34:53 -0800 Subject: [PATCH] Don't send status through the filter stack twice when receiving trailers --- packages/grpc-js-xds/package.json | 2 +- packages/grpc-js/package.json | 2 +- packages/grpc-js/src/call-stream.ts | 15 +-------------- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/grpc-js-xds/package.json b/packages/grpc-js-xds/package.json index b5c9d3f1..6ff85816 100644 --- a/packages/grpc-js-xds/package.json +++ b/packages/grpc-js-xds/package.json @@ -45,7 +45,7 @@ "@grpc/proto-loader": "^0.6.0-pre14" }, "peerDependencies": { - "@grpc/grpc-js": "~1.2.7" + "@grpc/grpc-js": "~1.2.10" }, "engines": { "node": ">=10.10.0" diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 8fffe4be..939827b2 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "1.2.9", + "version": "1.2.10", "description": "gRPC Library for Node - pure JS implementation", "homepage": "https://grpc.io/", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", diff --git a/packages/grpc-js/src/call-stream.ts b/packages/grpc-js/src/call-stream.ts index a51c1da2..8fcc7065 100644 --- a/packages/grpc-js/src/call-stream.ts +++ b/packages/grpc-js/src/call-stream.ts @@ -442,21 +442,8 @@ export class Http2CallStream implements Call { ); } const status: StatusObject = { code, details, metadata }; - let finalStatus; - try { - // Attempt to assign final status. - finalStatus = this.filterStack.receiveTrailers(status); - } catch (error) { - // This is a no-op if the call was already ended when handling headers. - this.endCall({ - code: Status.INTERNAL, - details: 'Failed to process received status', - metadata: new Metadata(), - }); - return; - } // This is a no-op if the call was already ended when handling headers. - this.endCall(finalStatus); + this.endCall(status); } attachHttp2Stream(