router icon indicating copy to clipboard operation
router copied to clipboard

Router responds with different error message for 400 subgraph responses than gateway

Open danpayne17 opened this issue 1 year ago • 3 comments

Describe the bug If the router receives a 400 from a subgraph, the error object the router returns to the caller will contain an empty error message which is different than what the gateway did. The gateway would return a generic error message with the subgraph name:

Router:

  "errors": [
    {
      "message": "",
      ...

Gateway:

  "errors": [
    {
      "message": "Error while fetching subquery from service \"demo-subgraph\"",
      ...

To Reproduce Steps to reproduce the behavior:

  1. Setup a router with a single subgraph
  2. Have the subgraph return a 400 BAD_REQUEST error
  3. See error

Expected behavior The router exhibits the same behavior as the gateway and includes a non-empty, generic error message

Output See above

Router:

  • Version: 1.45.1

danpayne17 avatar May 24 '24 16:05 danpayne17

this was an intentional decision early on in the router, to hide internal architecture details from responses in production. To transmit the subgraph errors to the client, you can use the include_subgraph_errors option.

Geal avatar May 27 '24 08:05 Geal

@danpayne17 Could you please confirm that @Geal answer meets your requirements?

garypen avatar Jun 03 '24 09:06 garypen

@Geal whether include_subgraph_errors is enabled or not has no effect on this behavior. We have it enabled yet still get the empty error message whereas the gateway would return that generic error message

danpayne17 avatar Jun 03 '24 14:06 danpayne17