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
Hey! 👋 I've been using your library a bit, and I happened on an error with streams. I'm wondering if maybe the received gun_data might have what I'm looking for or if the server isn't receiving a response.
I don't know it's the grpc library or the way I'm using it, but I could use a little guidance. Here's all the relevant information:
The Test Failure
$ mix test test/ledger_grpc_test.exs
received a msg: {:gun_data, #PID<0.203.0>, #Reference<0.1984767090.2531262471.251349>, :nofin, <<0, 0, 0, 0, 3, 10, 1, 48>>}
received a msg: {:gun_trailers, #PID<0.203.0>, #Reference<0.1984767090.2531262471.251349>, [{"grpc-status", "0"}]}
1) test list_active_contracts/1 with valid data lists all active contracts (Ledger.GrpcTest)
test/ledger_grpc_test.exs:99
** (FunctionClauseError) no function clause matching in anonymous fn/1 in Ledger.GrpcTest."test list_active_contracts/1 with valid data lists all active contracts"/1
The following arguments were given to anonymous fn/1 in Ledger.GrpcTest."test list_active_contracts/1 with valid data lists all active contracts"/1:
# 1
{:error, %GRPC.RPCError{message: "timeout when waiting for server", status: 4}}
code: replies = Enum.each(reply_enum, fn {:ok, reply} -> IO.inspect(reply) end)
stacktrace:
test/ledger_grpc_test.exs:120: anonymous fn/1 in Ledger.GrpcTest."test list_active_contracts/1 with valid data lists all active contracts"/1
(elixir) lib/enum.ex:789: anonymous fn/3 in Enum.each/2
(elixir) lib/enum.ex:3023: anonymous fn/3 in Enum.each/2
(elixir) lib/stream.ex:1514: Stream.do_unfold/4
(elixir) lib/enum.ex:3023: Enum.each/2
test/ledger_grpc_test.exs:120: (test)
Finished in 20.0 seconds
1 test, 1 failure
Randomized with seed 3781
The Test:
# test
test "list_active_contracts/1 with valid data lists all active contracts", %{
ledger_info: ledger_info
} do
options = %LedgerApi.GetActiveContractsRequest{
ledger_id: ledger_info.ledger_id,
filter: %LedgerApi.TransactionFilter{
filters_by_party: %{
"insurance" => %LedgerApi.Filters{
inclusive: nil
}
}
},
verbose: true,
trace_context: nil
}
reply_enum = Ledger.Grpc.list_active_contracts(options)
replies = Enum.each(reply_enum, fn {:ok, reply} -> IO.inspect(reply) end)
end
The library functions being called:
# client api
def list_active_contracts(options),
do: GenServer.call(__MODULE__, {:list_active_contracts, options}, :infinity)
# server api
@impl true
def handle_call({:list_active_contracts, options}, _pid, ledger_info) do
{:ok, stream} =
ledger_info.channel
|> LedgerApi.ActiveContractsService.Stub.get_active_contracts(options)
{:reply, stream, ledger_info}
end
# extra logging
@impl true
def handle_info(msg, ledger_state) do
_ ->
IO.puts("received a msg: #{inspect(msg)}")
end
{:noreply, ledger_state}
end
The grpc server's log:
Serving an Active Contracts request...
Call 2: Buffered demand event from gRPC downstream.
Call 2: RS upstream subscription registered. Setting up onCancelHandler and onReadyHandler handlers.
Call 2: Flushing demand event to RS upstream.
Call 2: gRPC downstream is ready. Demanding new response from RS upstream.
Call 2: RS upstream emitted response message GetActiveContractsResponse(0,,List(),None).
Call 2: RS upstream completed.
[id: 0xfaf2d4ac, L:/127.0.0.1:6865 - R:/127.0.0.1:56274] OUTBOUND HEADERS: streamId=5 headers=GrpcHttp2OutboundHeaders[:status: 200, content-type: application/grpc, grpc-encoding: identity, grpc-accept-encoding: gzip] streamDependency=0 weight=16 exclusive=false padding=0 endStream=false
Call 2: gRPC downstream is ready. Demanding new response from RS upstream.
[id: 0xfaf2d4ac, L:/127.0.0.1:6865 - R:/127.0.0.1:56274] OUTBOUND DATA: streamId=5 padding=0 endStream=false length=8 bytes=00000000030a0130
[id: 0xfaf2d4ac, L:/127.0.0.1:6865 - R:/127.0.0.1:56274] OUTBOUND HEADERS: streamId=5 headers=GrpcHttp2OutboundHeaders[grpc-status: 0] streamDependency=0 weight=16 exclusive=false padding=0 endStream=true
The text was updated successfully, but these errors were encountered:
Hey! 👋 I've been using your library a bit, and I happened on an error with streams. I'm wondering if maybe the received gun_data might have what I'm looking for or if the server isn't receiving a response.
I don't know it's the grpc library or the way I'm using it, but I could use a little guidance. Here's all the relevant information:
The Test Failure
The Test:
The library functions being called:
The grpc server's log:
The text was updated successfully, but these errors were encountered: