quarkus: Broken context propagation in HTTP request that involves hibernate-reactive-panache, resteasy-reactive and qute

Describe the bug

The CDI request context is not active when a template (that leverages a @RequestScoped bean) is rendered in a Uni chain:

    @GET
    public Uni<TemplateInstance> get(@QueryParam("id") Long id) {
        // Fruit extends io.quarkus.hibernate.reactive.panache.PanacheEntity
        return Fruit.findById(id).onItem().transform(f -> Templates.fruit((Fruit) f));
    }

How to Reproduce?

  1. Checkout this quarkus-quickstarts branch
  2. Run the modified hibernate-reactive-panache-quickstart in the dev mode (can be reproduced in the prod mode as well)
  3. HTTP GET http://localhost:8080/test/template?id=1

You should see a ContextNotActiveException in the console.

UPDATE: I’ve added two more simplified resource methods which produce a slightly different error:

javax.enterprise.inject.IllegalProductException: Normal scoped producer method may not return null: io.quarkus.vertx.http.runtime.CurrentVertxRequest.getCurrent()

It seems that the request context is active but the CurrentVertxRequest bean instance is not propagated.

How to get this error:

  1. HTTP GET http://localhost:8080/test/simple?id=1 - this one does not involve a qute template
  2. HTTP GET http://localhost:8080/test/no-hibernate?id=1 - this one does not involve hibernate-reactive-panache

It might be as well a PEBKAC on my side. I would be more than happy if someone explains to me what’s going on here 😉

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 27 (26 by maintainers)

Commits related to this issue

Most upvoted comments

I’m going to close this one because I was not able to reproduce any of the problems after https://github.com/quarkusio/quarkus/pull/27497 and https://github.com/quarkusio/quarkus/pull/27443 were merged!