8

There is an application on Spring Web stack. I faced an unusal problem after the upgrading to the lastest Spring Boot 2.6.1.

The following code

@RestController
@RequestMapping("sample")
class SampleController {
    @PostMapping
    fun doSomething(@RequestBody body: Any): Any {
        error("Error!")
    }
}

used to produce the following error in earlier versions

{
    "timestamp": "2020-05-27T13:44:58.032+00:00",
    "status": 500,
    "error": "Internal Server Error",
    "message": "Error!",
    "path": "/sample"
}

But after the upgrade the whole response body is empty. Not the message field which is could be fixed with server.error.inclide-message: always flag setting, but the whole body. The include-binding-errors: always flag has no effect as well.

I found no notes about that behavior in the Spring Boot changelog

kirill.login
  • 899
  • 1
  • 13
  • 28

2 Answers2

7

Have a look at this issue: https://github.com/spring-projects/spring-boot/issues/28953

If you permit access to the /error whitelabel page in your SecurityConfig it should work again. However, this seems to be a workaround as the issue is still in progress.

ToFi
  • 1,167
  • 17
  • 29
  • 1
    Well, the `/error` path was already ignored by the security mechanism. Thank you for mentioning the issue. Seems like there is some misunderstanding between the Web and Security teams and therefore the problem has no easy solution. Also shame to Pivotal for delivering such a dank solution to production. – kirill.login Dec 13 '21 at 05:57
0

So it was a bug in 2.6.0 and 2.6.1 version. Fixed in 2.6.2

kirill.login
  • 899
  • 1
  • 13
  • 28