Hello! I need some help with Wiremock gRPC plugin....
# general
t
Hello! I need some help with Wiremock gRPC plugin. After configuring it with mapping like that
Copy code
{
  "request": {
    "method": "POST",
    "urlPath": "/dbag.energy.m7g.internal.core.v1.DataAccessService/WatchOutputEvents"
  },
  "response": {
    "status": 200,
    "headers": {
      "Content-Type": "application/grpc+json"
    },
    "jsonBody": {
      "snapshot": {
        "orders": {
          "order": [
            {
              "id": "1"
            },
            {
              "id": "2"
            },
            {
              "id": "3"
            }
          ]
        },
        "product_snapshot": {
          "product": []
        }
      }
    }
  }
}
I'm getting errors at the client side like that
Copy code
Exception in thread "main" io.grpc.StatusException: INTERNAL: gRPC frame header malformed: reserved bits not zero
I've tried different client configurations with palintext parameter and without it but result is generally the same. Could you hel;p me to guess what could be wrong there...
t
Bit of a punt, but have you tried removing the Content-Type header?
t
Yes. I'm getting error that content type null is wrong.
As an alternative question probably exists a way how to pass string like that in mapping?
Copy code
//x00//x00//x00//x00//x15{"message":"Hello"}"
@Tom sorry for bothering😊
t
Did you remove the
headers
element completely or null the value?
t
I remove it completely like it was in the example
Also if I try anything not like
application/grpc
or
application/grpc+...
I'm getting same error
t
I think I’d need a reproducer project to make any more progress with this. I can’t see anything obviously wrong with what you’re attempting.
t
Hm... I will try... But may I ask a bit different thing. As far as I know gRPC is a binary format and as I can see from Wireshark logs all my gRPC servers are sending binary code which is not looks like JSON. But as far as I can see the Wiremock in gRPC mode is operating with JSON. Where I'm wrong here?
t
The WireMock extension converts the JSON response you specify in the stub to protobuf
So the JSON never actually gets sent anywhere, it’s just a way of specifying the data you want
t
Looks like I found a way to reproduce! If in examples from here https://github.com/wiremock/wiremock-grpc-demos/tree/main You will change gRPC server implementation to
Copy code
testImplementation("io.grpc:grpc-netty:1.61.1")
You will get same error as me. UPDATE: It's about the gRPC version. If I downgrade to 1.59.0 it works also with Netty implementation. If you don't mind I can try to fix that.
t
That would be much appreciated!
t
Sorry that was my fault. I used wiremock-grp-extension instead of wiremock-grap-extension-standalone
t
Ah, that’ll be it then 🙂
166 Views