facebookfacebook-graph-apifacebook-workplace

Facebook Workplace Compliance Integration - Error code 960


I am writing a Compliance Integration using Python and the Facebook Graph API to search all user content in our Workplace community for given keywords. I have something that previously worked every time, however recently (over the last couple of days) one of the requests sent to Facebook will return a FacebookApiException with the error code 960 with a message "Request aborted. This could happen if a dependent request failed or the entire request timed out." after having already successfully received thousands of successful requests. This doesn't occur all the time, but more often than not it will fail.

{
  "error": {
    "message": "Request aborted. This could happen if a dependent request failed or the entire request timed out.",
    "code": 960,
    "type": "FacebookApiException",
    "fbtrace_id": "B72L8jiCFZy"
  }
}

For simplicity I haven't been using dependencies in my requests, so I can only think that it is timing out. My question is -- what is the timeout period for the Facebook Graph API? Is it timing out because I am taking too long to send a request, or is it timing out because the Facebook server is taking too long to respond to my request? Is there any way I can increase the timeout to stop the error message occurring?

TIA


Solution

  • This question is older, but in case anyone else is looking for an answer.

    I can't answer what the timeout period is for the Facebook Graph Api, but I can point out a workaround for those who are running into timeout errors.

    Facebook has documentation for how to deal with timouts: https://developers.facebook.com/docs/graph-api/making-multiple-requests/#timeouts

    Large or complex batches may timeout if it takes too long to complete all the requests within the batch. In such a circumstance, the result is a partially-completed batch. In partially-completed batches, responses from operations that complete successfully will look normal (see prior examples) whereas responses for operations that are not completed will be null.

    The ordering of responses correspond with the ordering of operations in the request, so developers should process responses accordingly to determine which operations were successful and which should be retried in a subsequent operation.

    So, according to their documentation, the response for a batch request that timed out should look something like this:

    [
        { "code": 200,
          "headers": [
              { "name":"Content-Type", 
                "value":"text/javascript; charset=UTF-8"}
           ],
          "body":"{\"id\":\"…\"}"
        },
        null,null,null
    ]
    

    Using their example, you should just need to re-queue the items in your batch request array that correspond with the null responses.