quarkus: Eclipse MicroProfile RestClient always returns Unknown error.

Describe the bug Calling a restAPI endpoint, using RestClient. The error message generated by the endpoint is not returned in the API exception.

Using postman, this is original response error:

{
    "error": "unsupported_grant_type",
    "error_description": "The authorization grant type is not supported by the authorization server. Configured grant types: [refresh_token, password, authorization_code, implicit]."
}

Expected behavior The expectation is that any service called will return the error message generated by the endpoint, and not an unknown error.

Actual behavior the original error message is being ignored, and returns an unknown error. WebApplicationException: Unknown error, status code 400

To Reproduce any application you use Eclipse MicroProfile RestClient will have this problem.

Environment:

  • Output of java 11:
  • Quarkus version 1.4.2:
  • Build tool mvn 3.6:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 24 (9 by maintainers)

Most upvoted comments

@deepfunction I had the same issue. The response for 4xx codes were arriving with empty payload to my fallback handler after update quarkus from 1.7.3.Final to 2.1.2.Final

I tried adding an exception mapper and the response arrives as expected there.

@Priority(1)
public class MyExceptionMapper implements ResponseExceptionMapper<RuntimeException> {
    @Override
    public RuntimeException toThrowable(Response response) {
        return new WebApplicationException(response);
    }
}

I can’t reproducer the problem.

By executing

POST http://localhost:8080/api/login/v2/login
Accept: application/json
Content-Type: application/json
Cache-Control: no-cache


{
 "userName": "teste@teste.com.br", "password": "*******"
}

I get:

HTTP/1.1 405 Method Not Allowed
Transfer-Encoding: chunked
Server: nginx
X-Content-Type-Options: nosniff
Public-Key-Pins-Report-Only: pin-sha256="******"; pin-sha256="******"; pin-sha256="******"; pin-sha256="******"; max-age=60; report-uri="https://okta.report-uri.com/r/default/hpkp/reportOnly"
Connection: keep-alive
Content-Length: 174
Date: Thu, 21 May 2020 15:15:27 GMT
Content-Type: application/json

{
  "errorCode": "E0000022",
  "errorSummary": "The endpoint does not support the provided HTTP method",
  "errorLink": "E0000022",
  "errorId": "********",
  "errorCauses": []
}

Response code: 405 (Method Not Allowed); Time: 1627ms; Content length: 174 bytes