Backend responds sometimes in 200 and other times in 500 on the same request

I'm sending a get request to my backend, not changing headers, nor params nor Auth. However, the response is totally random, sometimes it sends back a code 200 status and we get the wanted response, and other times (On the same request) sends an error 500.

The backend is an API that sends back employee data as XML.

Has anyone experienced this before? If so, what was the source of the problem ?

500200 Error.png

0 3 325
3 REPLIES 3

500 errors are common when the backend is experiencing issues. Any error code in the 5xx is related to a SERVER error. I would investigate the backend service to see if anything has changed recently. If the issue is intermittent and the backend service is behind a load balancer, this could mean that only SOME of the backend instances are experiencing issues and others are healthy. Also, I would inspect the request body that are being passed from Apigee to the backend to verify if it indeed the payload you intended to pass.

Thank you for your reply @apickelsimer ,

I have checked, but the request body sent from Apigee is exactly the same. Nothing changes, and the backend is working fine as it sometimes returns a code 200 response.

Do you think it could be a load balancer that causes the problem ? 

Could be, but it more likely the backend service itself. I would review the backend target logs to understand why it is emitting a 500 server error. Given its intermittent, this usually means there are multiple instances of the service behind a load balancer and only SOME of the instances are experiencing an error. But of course that is not the only possibly. There could be other root causes but the only way to find out is to investigate the backend.