bradleyjkemp/grpc-tools

Replaying requests without proto definitions

rithvikvibhu opened this issue ยท 4 comments

Is there any way to replay requests dumped by grpc-dump when the description files / definitions are not known?
Won't the raw_message field in the dump be enough to resend it (without modifications)?

Hey @rithvikvibhu, yes this is exactly what grpc-replay does (or at least should do!)

You can see an example of this in the integration test:

replayErr := replay.Run(

The messages in https://github.com/bradleyjkemp/grpc-tools/blob/master/integration_test/test-dump.json are replayed even though there are no proto descriptors for some of them. If grpc-replay doesn't have a descriptor for a message it will just send the raw message directly.

Are you seeing issues with this feature?

Yeah, looks like it isn't working for me.
image

I can confirm the file contains 1 line of json object, with 2 messages in it.
1 client and 1 server origin. The problem is probably because the client origin message is empty (as expected), and there's no raw_message.

{
    "messages":[
        {
            "message_origin": "client",
            "message": {}
        },
        {
            "message_origin": "server",
            "raw_message": "Coc***",
            "message": { /*...*/ }
        }
    ]
}

Ah I see the problem now! grpc-dump is omitting the "raw_message" field when it is empty but this is wrong: the empty string is a valid raw message (i.e. it's the empty message).

#106 should fix this issue

Hey, I tested this change, but it still says no resolver available when proto defs aren't given. But the dump now has raw_message: null when the message is {}.

Manually editing the dump from raw_message: null to raw_message: "" makes it work, though.