JalexSocial / SpiceDb

MIT License
19 stars 11 forks source link

Good for local development? #12

Closed dgg closed 5 months ago

dgg commented 5 months ago

Hi, My team is currently evaluating SpiceBb as an option for multi-tenant authorization for our new platform. Some of the projects hosted is such platform will be written in C# and, naturally, we found your library.

We are trying to play around with SpiceDb (figuring out how to model different scenarios, exploring the APIs and such) and we are doing it running the SpiceDb container locally.

I am not very familiar with gRPC either, but it does not seem that I am able to connect to the local instance of SpiceDb (I am able to do so with a container-running zed using the --insecure flag).

This is the exception I am getting:

System.AggregateException: One or more errors occurred. (No address resolver configured for the scheme 'localhost'.)
 ---> System.InvalidOperationException: No address resolver configured for the scheme 'localhost'.
   at Grpc.Net.Client.GrpcChannel.GetResolverFactory(GrpcChannelOptions options)
   at Grpc.Net.Client.GrpcChannel..ctor(Uri address, GrpcChannelOptions channelOptions)
   at Grpc.Net.Client.GrpcChannel.ForAddress(Uri address, GrpcChannelOptions channelOptions)
   at Grpc.Net.Client.GrpcChannel.ForAddress(String address, GrpcChannelOptions channelOptions)
   at SpiceDb.Api.Core.CreateAuthenticatedChannelAsync(String address)

This is what I am using to connect to the local server (I am using a mapped 50052 port as I have something else in my computer running in 50051):

    var client = new SpiceDbClient("localhost:50052", "somerandomkeyhere", "prefix");

And this is the docker-compose section:

services:
  spicedb:
    image: authzed/spicedb:v1.30.0
    command: serve --grpc-preshared-key "somerandomkeyhere"
    ports:
      - 50052:50051
  spicecli:
    image: authzed/zed:v0.17.1

Can you verify that I should be able to execute your library against this local environment?

Thanks in advance

tanczosm commented 5 months ago

The error sounds like it can't resolve localhost. Maybe try 127.0.0.1 as the IP instead of localhost.

On Sat, Mar 30, 2024, 3:43 AM Daniel Gonzalez Garcia < @.***> wrote:

Hi, My team is currently evaluating SpiceBb as an option for multi-tenant authorization for our new platform. Some of the projects hosted is such platform will be written in C# and, naturally, we found your library.

We are trying to play around with SpiceDb (figuring out how to model different scenarios, exploring the APIs and such) and we are doing it running the SpiceDb container locally.

I am not very familiar with gRPC either, but it does not seem that I am able to connect to the local instance of SpiceDb (I am able to do so with a container-running zed using the --insecure flag).

This is the exception I am getting:

System.AggregateException: One or more errors occurred. (No address resolver configured for the scheme 'localhost'.) ---> System.InvalidOperationException: No address resolver configured for the scheme 'localhost'. at Grpc.Net.Client.GrpcChannel.GetResolverFactory(GrpcChannelOptions options) at Grpc.Net.Client.GrpcChannel..ctor(Uri address, GrpcChannelOptions channelOptions) at Grpc.Net.Client.GrpcChannel.ForAddress(Uri address, GrpcChannelOptions channelOptions) at Grpc.Net.Client.GrpcChannel.ForAddress(String address, GrpcChannelOptions channelOptions) at SpiceDb.Api.Core.CreateAuthenticatedChannelAsync(String address)

This is what I am using to connect to the local server (I am using a mapped 50052 port as I have something else in my computer running in 50051):

var client = new SpiceDbClient("localhost:50052", "somerandomkeyhere", "prefix");

And this is the docker-compose section:

services: spicedb: image: authzed/spicedb:v1.30.0 command: serve --grpc-preshared-key "somerandomkeyhere" ports:

  • 50052:50051 spicecli: image: authzed/zed:v0.17.1

Can you verify that I should be able to execute your library against this local environment?

Thanks in advance

— Reply to this email directly, view it on GitHub https://github.com/JalexSocial/SpiceDb/issues/12, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUHLRBMQHO3RJTN43P5AX3Y2ZNJLAVCNFSM6AAAAABFPLI5HWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGIYTMMZRGIZDQNY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

dgg commented 5 months ago

That was a great pointer!

I was able to make it work using http://0.0.0.0:50052 (http is also important).

Thanks for your help