router
router copied to clipboard
Router Fails to Recognize content-type Header in Federated Service Responses Without Payloads
Describe the Bug
We are self-hosting the Router image on a Kubernetes cluster. Whenever a federated service returns a 4xx or 5xx status, the Router expects a payload in the response. If there is no payload, the Router does not recognize the content-type header in the response and returns the error: subgraph response does not contain 'content-type' header, even though the federated service response does include that header.
To Reproduce
Steps to reproduce the behavior:
- Create a federated service that defaults to returning a 500 status on any request, and include the "content-type", "application/json" header in the response.
- Submit a query through the Router to hit that federated service.
- Observe the error:
HTTP fetch failed from 'some-federated-service': subgraph response does not contain 'content-type' header; expected content-type: application/json or content-type: application/graphql-response+json.
Expected Behavior
This error should not occur, as the content-type header is already present in the response.
Output
{
"data": null,
"errors": [
{
"message": "HTTP fetch failed from 'some-federated-service': 500: Internal Server Error",
"extensions": {
"code": "SUBREQUEST_HTTP_ERROR",
"service": "some-federated-service",
"reason": "500: Internal Server Error",
"http": {
"status": 500
}
}
},
{
"message": "HTTP fetch failed from 'some-federated-service': subgraph response does not contain 'content-type' header; expected content-type: application/json or content-type: application/graphql-response+json",
"extensions": {
"code": "SUBREQUEST_HTTP_ERROR",
"service": "some-federated-service",
"reason": "subgraph response does not contain 'content-type' header; expected content-type: application/json or content-type: application/graphql-response+json",
"http": {
"status": 500
}
}
}
]
}
Router version:
- Version v1.52.0