Open viralams opened 1 year ago
@viralams gRPC mock URLs are publicly accessible, can you share more details about your use case?
I am able to create a mock URL from the UI no issues. But I am unable to curl or hit the url from the service/ui to get a mocked response.
@viralams It's a gRPC server URL, an HTTP/cURL request will not work.
My bad for bad wording. I tried it with grpcurl and a service that expects http2 calls.
I'm interested on this too. In my case I tried using postman to mock a grpc server to help me develop a python client without the real grpc server.
Trying this:
grpc.insecure_channel("g-xyz.srv.pstmn.io")
Yields to this error:
E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.UNAVAILABLE
E details = "failed to connect to all addresses; last error: UNAVAILABLE: ipv4:xxx.xxx.xxx.xxx:443: Socket closed"
E debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNAVAILABLE: ipv4:xxx.xxx.xxx.xxx:443: Socket closed {created_time:"2023-09-27T14:31:50.700184+01:00", grpc_status:14}"
E >
And this:
grpc.secure_channel("g-xyz.srv.pstmn.io", grpc.ssl_channel_credentials())
Yields to:
E grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E status = StatusCode.UNAVAILABLE
E details = "failed to connect to all addresses; last error: UNKNOWN: ipv4:xxx.xxx.xxx.xxx:443: Cannot check peer: missing selected ALPN property."
E debug_error_string = "UNKNOWN:failed to connect to all addresses; last error: UNKNOWN: ipv4:xxx.xxx.xxx.xxx:443: Cannot check peer: missing selected ALPN property. {grpc_status:14, created_time:"2023-09-27T14:33:39.861124+01:00"}"
E >
I just tried with grpcurl and its working like this:
$ grpcurl -import-path ../protos \
-proto my-stuff.proto \
g-xyz.srv.pstmn.io:443 \
my.custom.server.Service/Method
Our team has ran into the same issue when trying to test an Android application. grpcurl works fine, but the Java/Kotlin gRPC library (https://github.com/grpc/grpc-kotlin) cannot connect to the mock grpc server provided by Postman. I get the following error:
java.lang.RuntimeException: TLS ALPN negotiation failed with protocols: [h2]
It does not appear that the Postman server supports ALPN over HTTP/2.
I was able to use a mock server using https://github.com/tokopedia/gripmock with Android successfully, but that is not ideal as we have done all of our gRPC specification in Postman. It would be great if this were a supported usecase.
Is there an existing request for this feature?
Is your feature request related to a problem?
Id like to take advantage of the mock servers for gRPC in a few ways :
Describe the solution you'd like
Ensure this mock server is available to use outside of postman.
Describe alternatives you've considered
Havent gotten any alternatives
Additional context
This would be great for manual/automated integration testing.