File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @grpc/grpc-js" ,
3
- "version" : " 1.12.4 " ,
3
+ "version" : " 1.12.5 " ,
4
4
"description" : " gRPC Library for Node - pure JS implementation" ,
5
5
"homepage" : " https://grpc.io/" ,
6
6
"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 {
190
190
try {
191
191
messages = this . decoder . write ( data ) ;
192
192
} 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
+ }
194
209
return ;
195
210
}
196
211
You can’t perform that action at this time.
0 commit comments