I'm having an issue in gRPC that's been driving me crazy. I have a .NET gRPC service that my ReactJS client is connecting to - this works fine. I'm subscribing to my stream, and I get data over the stream as expected. I'm having an issue deserializing "bytes" or "google.protobuf.Any" types that exist in my messages. The one I'm receiving looks like this:
Inside of the ReactJS client I am doing the following:
useEffect(() => {
console.log("Subscribing to point stream");
var pointStream = client.subscribeToNotificationStream(new Empty(), {});
pointStream.on("data", (response) => {
switch (response.getKind())
{
case KindsOfPointNotification.KINDS_OF_POINT_NOTIFICATION_POINT_ADDED_OR_UPDATED:
console.log(NotificationPointAddedOrUpdated.deserializeBinary(response.getNotificationdata()));
break;
case KindsOfPointNotification.KINDS_OF_POINT_NOTIFICATION_POINT_REMOVED:
console.log("Point removed");
break;
}
});
When I call deserializeBinary I get an uncaught exception in the browser that says:
AssertionError: Assertion failed
at new __webpack_modules__../node_modules/google-protobuf/google-protobuf.js.goog.asserts.AssertionError (http://localhost:3000/static/js/bundle.js:10922:20)
at Object.__webpack_modules__../node_modules/google-protobuf/google-protobuf.js.goog.asserts.doAssertFailure_ (http://localhost:3000/static/js/bundle.js:10951:7)
at Object.__webpack_modules__../node_modules/google-protobuf/google-protobuf.js.goog.asserts.assert (http://localhost:3000/static/js/bundle.js:10960:53)
at __webpack_modules__../node_modules/google-protobuf/google-protobuf.js.jspb.BinaryDecoder.advance (http://localhost:3000/static/js/bundle.js:14845:16)
at __webpack_modules__../node_modules/google-protobuf/google-protobuf.js.jspb.BinaryReader.skipFixed64Field (http://localhost:3000/static/js/bundle.js:15240:161)
at __webpack_modules__../node_modules/google-protobuf/google-protobuf.js.jspb.BinaryReader.skipField (http://localhost:3000/static/js/bundle.js:15269:12)
at Function.proto.Point.NotificationPointAddedOrUpdated.deserializeBinaryFromReader (http://localhost:3000/static/js/bundle.js:6568:16)
at Function.proto.Point.NotificationPointAddedOrUpdated.deserializeBinary (http://localhost:3000/static/js/bundle.js:6541:59)
at Array.<anonymous> (http://localhost:3000/static/js/bundle.js:234:107)
at qc.<anonymous> (http://localhost:3000/static/js/bundle.js:20338:58)
I've also tried this with the google.protobuf.Any type with similar, but slightly different results that you can read about here:
This seems like an actual issue in grpc-web to me so I thought it prudent to bring to people's attention here. Does anyone know how to resolve this issue?
I'm having an issue in gRPC that's been driving me crazy. I have a .NET gRPC service that my ReactJS client is connecting to - this works fine. I'm subscribing to my stream, and I get data over the stream as expected. I'm having an issue deserializing "bytes" or "google.protobuf.Any" types that exist in my messages. The one I'm receiving looks like this:
In this case the bytes represent the following proto message, but it could be a variety of other messages:
Inside of the ReactJS client I am doing the following:
When I call deserializeBinary I get an uncaught exception in the browser that says:
I've also tried this with the google.protobuf.Any type with similar, but slightly different results that you can read about here:
https://stackoverflow.com/questions/70988812/grpc-any-type-uncaught-typeerror-deserialize-is-not-a-function
This seems like an actual issue in grpc-web to me so I thought it prudent to bring to people's attention here. Does anyone know how to resolve this issue?