https://linen.dev logo
#help
Title
# help
n

Navjot Singh

11/22/2023, 11:43 AM
Hi all, getting this error while using wiremock-grpc-extension standalone jar for the response type of the google.protobuf.Any
Copy code
Exception in thread "grpc-default-executor-2" wiremock.com.google.protobuf.InvalidProtocolBufferException: Missing type url when parsing: {"greeting":"Hello Duis"}
        at wiremock.com.google.protobuf.util.JsonFormat$ParserImpl.mergeAny(JsonFormat.java:1504)
        at wiremock.com.google.protobuf.util.JsonFormat$ParserImpl.access$2000(JsonFormat.java:1276)
        at wiremock.com.google.protobuf.util.JsonFormat$ParserImpl$1.merge(JsonFormat.java:1343)
        at wiremock.com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1432)
        at wiremock.com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1317)
        at wiremock.com.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:449)
        at org.wiremock.grpc.internal.JsonMessageUtils.lambda$toMessage$1(JsonMessageUtils.java:36)
        at com.github.tomakehurst.wiremock.common.Exceptions.uncheck(Exceptions.java:72)
        at org.wiremock.grpc.internal.JsonMessageUtils.toMessage(JsonMessageUtils.java:36)
        at org.wiremock.grpc.internal.UnaryServerCallHandler.lambda$invoke$0(UnaryServerCallHandler.java:92)
        at com.github.tomakehurst.wiremock.http.AbstractRequestHandler.handle(AbstractRequestHandler.java:101)
        at org.wiremock.grpc.internal.UnaryServerCallHandler.invoke(UnaryServerCallHandler.java:60)
        at org.wiremock.grpc.internal.UnaryServerCallHandler.invoke(UnaryServerCallHandler.java:31)
        at wiremock.grpc.io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:182)
        at wiremock.grpc.io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:351)
        at wiremock.grpc.io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:860)
        at wiremock.grpc.io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
        at wiremock.grpc.io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
to reproduce the issue use https://github.com/Navjotsingh25/GRPC_demo and hit the greeting3 in GreetingService
👀 1
can anybody please help me here
t

Tom

12/08/2023, 9:11 PM
I think I’ve fixed this issue here, albeit in a slightly hacky way: https://github.com/wiremock/wiremock-grpc-extension/pull/32 Would appreciate any feedback/confirmation it works in your environment.
n

Navjot Singh

01/08/2024, 1:24 PM
Hi @Tom how we can do this in stand alone server. Is there can be any way the any type Request get unpack on the bases of its descriptor file and its response get pack to any type Grpc response
t

Tom

01/08/2024, 2:36 PM
If you’re configuring from JSON (rather than the Java DSL) you need to include the
@type
element e.g. in: https://github.com/wiremock/wiremock-grpc-extension/blob/any-type-issue/src/test/java/org/wiremock/grpc/GrpcAcceptanceTest.java#L313
The Any support isn’t released yet so you’d need to build the grpc extension from the PR I mentioned earlier in this thread
n

Navjot Singh

01/11/2024, 6:16 PM
thanks Tom
2 Views