Tonic reports invalid flag err but it's not

Hi,
I'm trying to send a dynamic gRPC message by using rust-protobuf and tonic. Here's my attempt. It's almost there, but with an odd error.
To use it, start the server first, then the client.
And we will see the following output:

request: {"name": "World"}
reply: {"message": "Hello World!"}
Err(
    Status {
        code: Internal,
        message: "protocol error: received message with invalid compression flag: 10 (valid flags are 0 and 1) while receiving response with status: 200 OK",
        source: None,
    },
)

It says "invalid compression flag". Alright, let's get the packet:


and... I'm lost here.

I've been debugging it for a while. It seems like the Err is returned here:

it will jump to:

then:

and we got the "invalid compression flag" here:

image

It seems like the error arises when tonic try to fetch the trailers and clear the body. But it's not the correct body?

Problem solved. In case if anyone interested in, here's the context.

2 Likes