Graphql and rest api on same spring boot application causes wrong response codes

Viewed 292

I have a spring boot application that both have normal REST controllers and it also works as a GraphQL server.

Some time ago my DB crashed and I had

datasource:
  hikari:
    maximum-pool-size: 10
    minimum-idle: 1
    connection-timeout: 60000

So all requests to my server failed after 60 seconds cause they couldn't open a transaction. The return code in all GraphQL responses is 200 ok. And that's fine. But if my REST APIs fail they should return an error like 500 internal errors which they didn't. They also returned 200 OK.

Has anyone else experienced something similar?

I'm thinking it has something to do with the GraphQL dependency

<dependency>
    <groupId>com.graphql-java-kickstart</groupId>
    <artifactId>graphql-spring-boot-starter</artifactId>
    <version>12.0.0</version>
</dependency>

I haven't found anything that explains it yet and I haven't been able to reproduce the error.

0 Answers
Related