Open 0xR opened 1 year ago
I'm getting the following error:
cannot encode message google.protobuf.Any to JSON: "type.googleapis.com/com.company.MyType" is not in the type registry
This is caused because the typeRegistry is not provided from grpc-web-devtools.
In my own code I avoid the error by writing this:
const typeRegistry = createRegistry(MyType); ... const myMessage = new MyMessage({ some: 'data', myType: Any.pack(new MyType({})), }).toJson({ typeRegistry });
It is caused by this code calling toJson without a type registry. https://github.com/SafetyCulture/grpc-web-devtools/blob/7b97172fcf17ffb1d8c6f5a080ace9e06d313530/public/connect-web-interceptor.js#L13-L14
toJson
It would be nice if it's possible to supply a type registry to the grpc-web-devtools.
Docs for more info in Any Docs for more info on Registries
That happens in our project, too.
Thanks for this extension! Very useful!
I'm getting the following error:
This is caused because the typeRegistry is not provided from grpc-web-devtools.
In my own code I avoid the error by writing this:
It is caused by this code calling
toJson
without a type registry. https://github.com/SafetyCulture/grpc-web-devtools/blob/7b97172fcf17ffb1d8c6f5a080ace9e06d313530/public/connect-web-interceptor.js#L13-L14It would be nice if it's possible to supply a type registry to the grpc-web-devtools.
Docs for more info in Any Docs for more info on Registries