Skip to content

Disabling of Dev Services for Keycloak leads to startup error #37667

@michalvavrik

Description

@michalvavrik

Describe the bug

I read https://quarkus.io/version/main/guides/security-openid-connect-dev-services#disable-dev-services-for-keycloak and tried quarkus.oidc.tenant.enabled=false as suggested there and it leads to error and startup fails.

I expected this RPC service is created as proxy and never initialized as it is not needed, but Quarkus DEV UI seems to initialize all these services.

Please note that here I'm using quarkus.keycloak.devservices.enabled but this can happen whenever container is not started like when some of these conditions return null:

private RunningDevService startContainer(DockerStatusBuildItem dockerStatusBuildItem,

and same should go for OIDC dev svc.

Expected behavior

I can disable DEV UI.

Actual behavior

2023-12-11 20:41:15,883 ERROR [io.qua.dev.run.jso.JsonRpcCodec] (vert.x-eventloop-thread-0) Error in JsonRPC Call: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at io.smallrye.mutiny.unchecked.UncheckedSupplier.lambda$toSupplier$0(UncheckedSupplier.java:45)
	at io.smallrye.context.impl.wrappers.SlowContextualSupplier.get(SlowContextualSupplier.java:21)
	at io.smallrye.mutiny.operators.uni.builders.UniCreateFromItemSupplier.subscribe(UniCreateFromItemSupplier.java:28)
	at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
	at io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:51)
	at io.smallrye.mutiny.groups.UniSubscribe.with(UniSubscribe.java:110)
	at io.smallrye.mutiny.groups.UniSubscribe.with(UniSubscribe.java:88)
	at io.quarkus.devui.runtime.comms.JsonRpcRouter.route(JsonRpcRouter.java:199)
	at io.quarkus.devui.runtime.comms.JsonRpcRouter.lambda$addSocket$1(JsonRpcRouter.java:111)
	at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handleTextFrame(WebSocketImplBase.java:636)
	at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handle(WebSocketImplBase.java:602)
	at io.vertx.core.http.impl.WebSocketImplBase$FrameAggregator.handle(WebSocketImplBase.java:591)
	at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:277)
	at io.vertx.core.http.impl.WebSocketImplBase.receiveFrame(WebSocketImplBase.java:536)
	at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:255)
	at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:134)
	at io.vertx.core.http.impl.WebSocketImplBase.handleFrame(WebSocketImplBase.java:476)
	at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:76)
	at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:174)
	at io.vertx.core.http.impl.Http1xConnectionBase.handleWsFrame(Http1xConnectionBase.java:64)
	at io.vertx.core.http.impl.Http1xServerConnection.handleOther(Http1xServerConnection.java:191)
	at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:176)
	at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:159)
	at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:115)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.devui.runtime.comms.JsonRpcRouter.lambda$invoke$0(JsonRpcRouter.java:98)
	at io.smallrye.mutiny.unchecked.UncheckedSupplier.lambda$toSupplier$0(UncheckedSupplier.java:41)
	... 48 more
Caused by: java.lang.NullPointerException: Cannot invoke "io.quarkus.oidc.runtime.devui.OidcDevUiRpcSvcPropertiesBean.getAuthorizationurl("")" because "props" is null
	at io.quarkus.oidc.runtime.devui.OidcDevJsonRpcService.<init>(OidcDevJsonRpcService.java:56)
	at io.quarkus.oidc.runtime.devui.OidcDevJsonRpcService_Bean.doCreate(Unknown Source)
	at io.quarkus.oidc.runtime.devui.OidcDevJsonRpcService_Bean.create(Unknown Source)
	at io.quarkus.oidc.runtime.devui.OidcDevJsonRpcService_Bean.create(Unknown Source)
	at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:118)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:38)
	at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:35)
	at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.c16(Unknown Source)
	at io.quarkus.arc.generator.Default_jakarta_enterprise_context_ApplicationScoped_ContextInstances.computeIfAbsent(Unknown Source)
	at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:35)
	at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:21)
	at io.quarkus.oidc.runtime.devui.OidcDevJsonRpcService_ClientProxy.arc$delegate(Unknown Source)
	at io.quarkus.oidc.runtime.devui.OidcDevJsonRpcService_ClientProxy.getProperties(Unknown Source)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	... 51 more

How to Reproduce?

Steps to reproduce the behavior:

  1. quarkus create app oidc --extensions=resteasy-reactive,oidc
  2. cd oidc
  3. quarkus dev -Dquarkus.keycloak.devservices.enabled=false

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

I only tried 3.6 and 999-SNAPSHOT and they are affected. 3.2.9.Final is not affected.

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

I'm author of this bug. (not sure anymore, behavior changed) I'll fix it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions