Jay StGelais
03/10/2023, 6:51 PMfinal CerbosBlockingClient cerbosClient = new CerbosClientBuilder("unix:/sock/cerbos.sock").withPlaintext().buildBlockingClient();
The client is created without error, but once we try to issue an API call, we get the following error in our logs:
nested exception is dev.cerbos.sdk.CerbosException: RPC exception [Status{code=UNAVAILABLE, description=io exception, cause=io.grpc.netty.shaded.io.netty.channel.AbstractChannel$AnnotatedConnectException: connect(..) failed: Address family not supported by protocol: /sock/cerbos.soc
Not sure if we are specifying the unix socket correctly in this example and struggling to find examples online that do this.Caused by: java.net.ConnectException: connect(..) failed: Address family not supported by protocol
at io.grpc.netty.shaded.io.netty.channel.unix.Errors.newConnectException0(Errors.java:155)
at io.grpc.netty.shaded.io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128)
at io.grpc.netty.shaded.io.netty.channel.unix.Socket.connect(Socket.java:313)
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect0(AbstractEpollChannel.java:773)
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollSocketChannel.doConnect0(EpollSocketChannel.java:144)
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect(AbstractEpollChannel.java:758)
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.connect(AbstractEpollChannel.java:600)
at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533)
at io.grpc.netty.shaded.io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:54)
at io.grpc.netty.shaded.io.grpc.netty.WriteBufferingAndExceptionHandler.connect(WriteBufferingAndExceptionHandler.java:157)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.access$1000(AbstractChannelHandlerContext.java:61)
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext$9.run(AbstractChannelHandlerContext.java:538)
at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:391)
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Unknown Source)
}]] with root cause
java.net.ConnectException: connect(..) failed: Address family not supported by protocol
at io.grpc.netty.shaded.io.netty.channel.unix.Errors.newConnectException0(Errors.java:155) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.unix.Socket.connect(Socket.java:313) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect0(AbstractEpollChannel.java:773) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollSocketChannel.doConnect0(EpollSocketChannel.java:144) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel.doConnect(AbstractEpollChannel.java:758) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.connect(AbstractEpollChannel.java:600) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.connect(DefaultChannelPipeline.java:1342) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.connect(AbstractChannelHandlerContext.java:533) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.ChannelDuplexHandler.connect(ChannelDuplexHandler.java:54) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.grpc.netty.WriteBufferingAndExceptionHandler.connect(WriteBufferingAndExceptionHandler.java:157) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeConnect(AbstractChannelHandlerContext.java:548) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.access$1000(AbstractChannelHandlerContext.java:61) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext$9.run(AbstractChannelHandlerContext.java:538) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:391) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[grpc-netty-shaded-1.53.0.jar:1.53.0]
at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
Charith (Cerbos)
03/10/2023, 7:05 PMunix:///sock/cerbos.sock
Jay StGelais
03/10/2023, 7:06 PMCharith (Cerbos)
03/10/2023, 7:10 PMgrpc-java
doesn't support Unix domain sockets (https://github.com/grpc/grpc-java/issues/1539). Perhaps try with TCP? If you are using a side car, you can make Cerbos listen on 127.0.0.1 only so it won't be accessible from the outside anyway.Jay StGelais
03/10/2023, 7:10 PMdev.cerbos.sdk.CerbosException: RPC exception [Status{code=INTERNAL, description=Resources query plan request failed, cause=null}]] with root cause
dev.cerbos.sdk.CerbosException: RPC exception [Status{code=INTERNAL, description=Resources query plan request failed, cause=null}]
at dev.cerbos.sdk.CerbosBlockingClient.plan(CerbosBlockingClient.java:149) ~[cerbos-sdk-java-v0.5.0.jar:na]
...
Is there a way to turn request logging on for the client, to capture the post bodies?