4

We are trying to use streams with a net core backend but getting deserialize error

"grpc":{2 items
    "method":string"*****"
    "error":{2 items
    "code":int2
    "message":string"Error in response deserializer function."
  }
}

protoc is version 3.14.0 grpc-web-gen is 1.2.1

command to generate the client is: protoc -I=./protos ./protos/*.proto --js_out=import_style=commonjs,binary:./dist --grpc-web_out=import_style=commonjs+dts,mode=grpcwebtext:./dist

We successfully connect to the endpoint and retrieve the data and the call fails on tying to use response.getMessage() Since there is no other error message and debugging is not very straightforward any insight on what could cause this error would be welcome :)

thank you

Julius Koronci
  • 408
  • 4
  • 10

1 Answers1

3

I got the same error with gRPC Web because I copied the example without realizing getMessage() was not part of the framework API, but a message string field in the example Protobuf definition.

Try using response directly (or serializing it with toObject())

var stream = echoService.serverStreamingEcho(streamRequest, metadata);
stream.on('data', function(response) {
  console.log(response.toObject());
});
Matteo Nardi
  • 199
  • 2
  • 7