goodhamgupta / authzed_ex

Unofficial SpiceDB client library for Elixir
Apache License 2.0
11 stars 8 forks source link

Reusing Client causes gRPC Error #10

Open moritzploss-k opened 1 year ago

moritzploss-k commented 1 year ago

Thanks for making this library!

I'm currently debugging an issue where I can first make a successful call to SpiceDB, but then get a gRPC error :down :normal on the second request, and :down: :noproc on all following requests. I'm re-using the same client object for all calls:

alias Authzed.Api.V1

def call_spice_db(client) do
  client.permissions_service.write_relationships(client.channel, ...) 
end

def main do
  client = V1.Client.new("url:port", V1.GRPCUtil.insecure_bearer_auth_token("token"))
  {:ok, %{written_at: _}}                              = call_spice_db(client)
  %GRPC.RPCError{status: 2, message: ":down: :normal"} = call_spice_db(client)
  %GRPC.RPCError{status: 2, message: ":down: :noproc"} = call_spice_db(client)
end

I'm not a gRPC expert, but my understanding is that it should be possible to re-use channels for multiple requests, and therefore re-use the same client object. Any help would be much appreciated!

goodhamgupta commented 1 year ago

Hi @moritzploss-k,

Thanks for reporting the issue! I tried to replicate this error, but was unable to see the error you're facing. I executed the test available at in the repo, where I

Would it be possible to provide a detailed example which can replicate your error?