Bad API response 503 Service Unavailable

Error Description

When making an API call, the response could fail and return one of the messages

<!DOCTYPE html>
<html>
  <head>
    <title>503 Service Unavailable</title>
  </head>
  <body>
    <h1>Error 503 Service Unavailable</h1>
    <p>Service Unavailable</p>
    <h3>Guru Meditation:</h3>
    <p>XID: 334397917</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>

or in the logs, you'll see

2021-02-05 13:52:47,596 [WARN ] [uf-sdk-24945-18] [uf-sdk-24945-18-amqp-t-4] [c.s.u.sdk.impl.HttpDataFetcher] - Bad API response: HTTP/1.1 500 Internal Server Error 500, message: 'No specific message' https://stgapi.betradar.com/v1/descriptions/en/markets/559/variants/pre:markettext:86017?include_mappings=true

Applies to

  • UOF SDK - All

Symptoms

When invoking Sport Event or Market methods, if the result is not cached within the SDK, it may lead to API request failures. HTTP status codes like 5xx (SERVICE_UNAVAILABLE or INTERNAL_SERVER_ERROR) indicate temporary problems on the API server side.

Such failures may manifest in REST logs via response_code values of SERVICE_UNAVAILABLE or INTERNAL_SERVER_ERROR. Depending on the exception handling strategy, users may receive exceptions in their calling code.

In this case, the SDK cannot take any action as it has not received any data from the API. However, it will automatically retry the request on the next user request.

Resolution

  • Verify Request Validity - Ensure the request is valid, including correct match ID, competitor ID, etc.

  • Retry Later - Retry failed requests later; temporary API issues might resolve.

  • Implement Retry Strategy - For non-critical data, consider implementing a retry strategy in a different thread invoked at a later time.

  • Check Failure Type - Determine the type of failure (e.g., bad request, failure at gateway or backend) to diagnose and address the issue effectively.

Last updated

Was this helpful?