Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot inject io.vertx.mutiny.ext.web.RoutingContext in @Route annotated method #17412

Closed
symphony-youri opened this issue May 21, 2021 · 6 comments · Fixed by #17414
Closed
Labels
Milestone

Comments

@symphony-youri
Copy link
Contributor

Describe the bug

In the documentation (https://quarkus.io/guides/reactive-routes#reactive-route-methods), it is written that a RoutingContext (Mutiny Smallrye one) can be injected in a @route annotated method. However trying to do that raises an exception.

Expected behavior

io.vertx.mutiny.ext.web.RoutingContext can be injected in a @route method.

Actual behavior

Exception is raised at startup with the message:

2021-05-21 15:31:34,176 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
	[error]: Build step io.quarkus.vertx.web.deployment.VertxWebProcessor#validateBeanDeployment threw an exception: java.lang.IllegalStateException: No parameter injector found for parameter 0 of route method io.smallrye.mutiny.Uni<java.lang.String> proxyPost(io.vertx.mutiny.ext.web.RoutingContext context) declared on CLASS bean [types=[com.symphony.scrypto.proxy.CryptoProxyController, java.lang.Object], qualifiers=[@Default, @Any], target=com.symphony.scrypto.proxy.CryptoProxyController]
	at io.quarkus.vertx.web.deployment.VertxWebProcessor.validateRouteMethod(VertxWebProcessor.java:494)
	at io.quarkus.vertx.web.deployment.VertxWebProcessor.validateBeanDeployment(VertxWebProcessor.java:171)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
	at java.base/java.lang.Thread.run(Thread.java:834)
	at org.jboss.threads.JBossThread.run(JBossThread.java:501)```


## To Reproduce

Create a route like:

@route(path = "/*", produces = "application/json")
public Uni route(io.vertx.ext.web.RoutingContext rc) {

}


### Quarkus version or git rev

1.13.3

@symphony-youri symphony-youri added the kind/bug Something isn't working label May 21, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented May 21, 2021

/cc @cescoffier, @jponge

@cescoffier
Copy link
Member

//CC @mkouba

@cescoffier
Copy link
Member

The problem seems to be the injection of the routing context, while you are returning a Uni. Do you need the full routing context? Did you try with just the HTTP request?

@mkouba
Copy link
Contributor

mkouba commented May 21, 2021

@symphony-youri Hm, the docs is wrong we don't support the io.vertx.mutiny.ext.web.RoutingContext. However, you can use the io.vertx.ext.web.RoutingContext or the mutiny versions of the request/response, i.e. io.vertx.mutiny.core.http.HttpServerRequest and io.vertx.mutiny.core.http.HttpServerResponse.

@mkouba
Copy link
Contributor

mkouba commented May 21, 2021

@cescoffier I think that we should just remove the mutiny version of RC from the docs. WDYT?

youribonnaffe pushed a commit to youribonnaffe/quarkus that referenced this issue May 21, 2021
Although being documented, RoutingContext from Mutiny is not supported
in @route annotated method. Update documentation accordingly.

Fix quarkusio#17412
@symphony-youri
Copy link
Contributor Author

(waouh super fast feedback)

Indeed it was working with the Http Request (mutiny or vertx ones) and with the vertx RoutingContext too.
Right now I'm working around that with:
io.vertx.mutiny.ext.web.RoutingContext context = new io.vertx.mutiny.ext.web.RoutingContext(rc);

Maybe the documentation should be updated then to avoid the confusion?
I opened #17414 for that.

@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone May 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants