quarkus: Keycloak with Reactive Routes Error: Request has already been read

I’ve tried to run a quarkus with keyckoak policy enforcer and reactive routes (no resteasy at all). It fails with the following error: ERROR: HTTP Request to /fhir/test failed, error id: f92ad12f-7a15-4fc4-b1cd-7d99ab09df0d-1 java.lang.IllegalStateException: Request has already been read at io.vertx.core.http.impl.HttpServerRequestImpl.checkEnded(HttpServerRequestImpl.java:600) at io.vertx.core.http.impl.HttpServerRequestImpl.handler(HttpServerRequestImpl.java:307)

This is my config:

quarkus.keycloak.policy-enforcer.enable=true quarkus.keycloak.policy-enforcer.enforcement-mode=PERMISSIVE quarkus.keycloak.policy-enforcer.path-cache.lifespan=36000000 quarkus.keycloak.policy-enforcer.paths.0.path=${quarkus.http.root-path}/test quarkus.keycloak.policy-enforcer.paths.0.enforcement-mode=DISABLED quarkus.keycloak.policy-enforcer.paths.999.path=/* quarkus.keycloak.policy-enforcer.paths.999.enforcement-mode=ENFORCING

The paths where it fails is the path disabled for policy enforcing. I guess the same error will occur and for secured paths

Sample project : keycloak-with-reactive-routes-error

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 28 (18 by maintainers)

Commits related to this issue

Most upvoted comments

Hi, I just ran into the same issue (IllegalStateException: “Request has already been read”) with a vert.x route secured by basic auth based on quarkus-elytron-security-properties-file. Here’s a minimal working example: https://github.com/schulzp/quarkus-vertx-body-already-read (run the ReactiveRoutesTest).

@sberyozkin @tpenakov The NPE should not happen anymore in latest releases due to this fix https://github.com/quarkusio/quarkus/pull/5456.

Not sure about the route though, need to investigate.