You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[sdk-platform-java] Handle google.rpc.ErrorInfo in HttpJson*Stub class #12465
In the possible solution part, the types are added recursively in TypeRegistry.Builder.add() method.
However, only two types serves as the "root" of this method, WaitRequest and WaitResponse, we need to understand the reason behind this before adding ErrorInfo into the registry.
I'm afraid this issue is more complicated than we expected. The new Showcase feature tests that we can deserialize an Any field to a concrete field in ErrorInfo, which is only used by the Error Details feature, and it was deferred last year. See b/260671246 for details. In short, we can not support this test for HttpJson stubs until Error Details feature is implemented for REGAPIC.
In the mean time, I think it's still worth it to add a showcase test for gRPC.
Verified that adding ErrorInfo to the type registry should fix this issue, see googleapis/sdk-platform-java#3093. However, we need to figure out where exact to add the additional types, either in Gax or generated layers.
Theoretically this issue can be tackled individually, but it will likely be resolved if the actionable ErrorDetails project is implemented for httpjson. Hence keeping this as a P3.
I reported a related issue at #12247. That issue is about a failure in parsing error status during server streaming calls. It has two underlying problems:
HttpJsonClientCallImpl.consumeMessageFromStream() uses the TypeRegistry from HttpJsonCallOptions, ignoring the default registry in ProtoMessageResponseParser. If the TypeRegistry is null in HttpJsonCallOptions, a NullPointerException is thrown.
DebugInfo is not added in TypeRegistry for HttpJson*Stub (this issue discussed here). This causes InvalidProtocolBufferException with "Cannot resolve type: type.googleapis.com/google.rpc.DebugInfo" even if the NPE issue is fixed.
changed the title [-]Handle `google.rpc.ErrorInfo` in HttpJson*Stub class[/-][+][sdk-platform-java] Handle `google.rpc.ErrorInfo` in HttpJson*Stub class[/+]on Apr 1, 2026
Activity
JoeWang1127 commentedon Nov 13, 2023
In the possible solution part, the types are added recursively in
TypeRegistry.Builder.add()method.However, only two types serves as the "root" of this method,
WaitRequestandWaitResponse, we need to understand the reason behind this before addingErrorInfointo the registry.lqiu96 commentedon Nov 13, 2023
Took a look at some of the code in Gax and I believe it may be due to the ProtoOperationTransformers: https://github.com/googleapis/sdk-platform-java/blob/9d30ed9b05dd77348899d312117e3fb562e7e6bd/gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/ProtoOperationTransformers.java#L130-L140
ServiceStubSettings transforms it from Any to the classes:
https://github.com/googleapis/sdk-platform-java/blob/9d30ed9b05dd77348899d312117e3fb562e7e6bd/showcase/gapic-showcase/src/main/java/com/google/showcase/v1beta1/stub/EchoStubSettings.java#L792-L795
I believe conversion from Any -> Class would require a TypeRegistry.
blakeli0 commentedon Nov 21, 2023
I'm afraid this issue is more complicated than we expected. The new Showcase feature tests that we can deserialize an
Anyfield to a concrete field inErrorInfo, which is only used by the Error Details feature, and it was deferred last year. See b/260671246 for details. In short, we can not support this test for HttpJson stubs until Error Details feature is implemented for REGAPIC.In the mean time, I think it's still worth it to add a showcase test for gRPC.
diegomarquezp commentedon Feb 7, 2024
I'll be demoting this to p3
blakeli0 commentedon Aug 9, 2024
Verified that adding
ErrorInfoto the type registry should fix this issue, see googleapis/sdk-platform-java#3093. However, we need to figure out where exact to add the additional types, either in Gax or generated layers.Theoretically this issue can be tackled individually, but it will likely be resolved if the actionable ErrorDetails project is implemented for httpjson. Hence keeping this as a P3.
baeminbo commentedon Feb 13, 2025
I reported a related issue at #12247. That issue is about a failure in parsing error status during server streaming calls. It has two underlying problems:
TypeRegistryfromHttpJsonCallOptions, ignoring the default registry inProtoMessageResponseParser. If theTypeRegistryisnullinHttpJsonCallOptions, aNullPointerExceptionis thrown.DebugInfois not added inTypeRegistryforHttpJson*Stub(this issue discussed here). This causesInvalidProtocolBufferExceptionwith "Cannot resolve type: type.googleapis.com/google.rpc.DebugInfo" even if the NPE issue is fixed.[-]Handle `google.rpc.ErrorInfo` in HttpJson*Stub class[/-][+][sdk-platform-java] Handle `google.rpc.ErrorInfo` in HttpJson*Stub class[/+]