SafetyCulture / grpc-web-devtools

Chrome & Firefox Browser extension to aid gRPC-Web development
MIT License
402 stars 51 forks source link

Support alternate protobuf implementations #169

Open dimo414 opened 10 months ago

dimo414 commented 10 months ago

I'm using protobuf.js with gRPC-web and running into a console stack trace when experimenting with this extension:

VM564:75 Uncaught TypeError: request.toObject is not a function
    at newCallback (<anonymous>:75:30)
    at Array.<anonymous> (index.js:66:1)
    at Lc (index.js:59:1)
    at qc.<anonymous> (index.js:57:1)
    at Jb (index.js:35:1)
    at O (index.js:34:1)
    at Ac (index.js:48:1)
    at push.679758.n.W (index.js:46:1)
    at push.679758.n.R (index.js:46:1)

protobuf.js does have a toObject() function but it's declared on the type rather than the message, i.e. request.$type.toObject() works.

It would be awesome if this extension a) handled failures more gracefully than raising a type exception and b) either automatically or via a config hook supported other deserialization operations. For example with protobuf-ts you'd want to call request.toJson().

dimo414 commented 10 months ago

Apparently google-protobuf is actually going away entirely so alternative library support will become necessary at some point.