Open majugurci opened 3 months ago
/cc @pedroigor (keycloak), @sberyozkin (keycloak)
@majugurci May be ClientResponseFilter
can help ? In general, as far as I know, the error body is not returned with exceptions to avoid it being leaked by accident back to the client of the Quarkus application which makes a REST client call.
Also CC @geoand
@sberyozkin I have tried with ClientResponseFilter and custom exception mapper but it seems it is not used with keycloak rest client.
If I register ClientResponseFilter or custom exception mapper with @ Provider annotation than it's methods are called for rest clients which I have in my application but not for the keycloak rest client.
I have also tried registering it through application.properties like this but it didn't help:
org.keycloak.admin.client.spi.ResteasyClientProvider/mp-rest/providers=org.filters.MyCustomFilter
or this
io.quarkus.keycloak.admin.client.reactive.runtime.ResteasyClientProvider/mp-rest/providers=org.filters.MyCustomFilter
EDIT: I guess it is related to this issue: https://github.com/quarkusio/quarkus/discussions/33332 Is there any other workaround I could try to get response body?
In general, as far as I know, the error body is not returned with exceptions to avoid it being leaked by accident back to the client of the Quarkus application which makes a REST client call. Also CC @geoand
Exactly correct
In general, as far as I know, the error body is not returned with exceptions to avoid it being leaked by accident back to the client of the Quarkus application which makes a REST client call. Also CC @geoand
Exactly correct
Could this be made configurable?
We have a use case where we're managing users in our web app through Keycloak admin api. If there is an error while updating a user there is no error explanation so we can only show "Unknown error" in our web application. As you can see that is not really helpful in case of an error like username contains invalid characters or email already in use.
Could this be made configurable?
It's the server that does not return the data containing the error message
It's the server that does not return the data containing the error message
By the server you mean the Keycloak server? If that is so I can confirm that Keycloak server is returning the error, I have attached debug log in original post.
Ah okay, then I'll leave this to @sberyozkin to explore options on the client part
@geoand Maybe this issue shouldn't be closed if you are planning to fix it?
Describe the bug
When using Quarkus with dependency quarkus-keycloak-admin-client-reactive and invoking some method which does not return Response how do I get real reason why invocation has failed?
For example, if I invoke a method to update user:
UserResource userResource = fetchUserById(userId); userResource.update(user);
I get the following exception stack trace:
Trying to get entity from ClientWebApplicationException or WebApplicationException is giving me null.
But if I turn on the debug log for http request:
I can see that http response has a body attached with a detail why request has failed. It's just that is is not mapped to an exception. For example:
But if I create a user:
I can read the entity from response which gives me reason why request have failed.
Does anyone know how to get response body when doing the user update?
I have tried implementing custom exception mappers but guess they don't work because it is handled by rest client.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response