File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @grpc/grpc-js" ,
3- "version" : " 1.12.4 " ,
3+ "version" : " 1.12.5 " ,
44 "description" : " gRPC Library for Node - pure JS implementation" ,
55 "homepage" : " https://grpc.io/" ,
66 "repository" : " https://github.com/grpc/grpc-node/tree/master/packages/grpc-js" ,
Original file line number Diff line number Diff line change @@ -190,7 +190,22 @@ export class Http2SubchannelCall implements SubchannelCall {
190190 try {
191191 messages = this . decoder . write ( data ) ;
192192 } catch ( e ) {
193- this . cancelWithStatus ( Status . RESOURCE_EXHAUSTED , ( e as Error ) . message ) ;
193+ /* Some servers send HTML error pages along with HTTP status codes.
194+ * When the client attempts to parse this as a length-delimited
195+ * message, the parsed message size is greater than the default limit,
196+ * resulting in a message decoding error. In that situation, the HTTP
197+ * error code information is more useful to the user than the
198+ * RESOURCE_EXHAUSTED error is, so we report that instead. Normally,
199+ * we delay processing the HTTP status until after the stream ends, to
200+ * prioritize reporting the gRPC status from trailers if it is present,
201+ * but when there is a message parsing error we end the stream early
202+ * before processing trailers. */
203+ if ( this . httpStatusCode !== undefined && this . httpStatusCode !== 200 ) {
204+ const mappedStatus = mapHttpStatusCode ( this . httpStatusCode ) ;
205+ this . cancelWithStatus ( mappedStatus . code , mappedStatus . details ) ;
206+ } else {
207+ this . cancelWithStatus ( Status . RESOURCE_EXHAUSTED , ( e as Error ) . message ) ;
208+ }
194209 return ;
195210 }
196211
You can’t perform that action at this time.
0 commit comments