Question

I have test code to post a comment. The code actually posts the comment correctly, but I'm receiving this error:

Fatal error: Uncaught OAuthException: An unexpected error has occurred. Please retry your request later. thrown in /blah/dee/blah/facebook/src/base_facebook.php on line 1340

This is the code. It works for likes (by changing "comments" with "likes") without error.

require '../facebook/src/facebook.php';
$facebook = new Facebook(array(
    'appId'  => '0000000000',
    'secret' => '000000000000000000000',
));
$response = $facebook->api('/00000000_00000000000001/comments', 'post', 
    array('message' => 'TEST: Testing comment post.')
);
// all ids have been replaced with 0s, rest assured that I have the correct ids 
// in the appropriate places.

I've looked up and down google and duckduckgo. I've seen one reference to this error with the sdk on SO but the answer was to remove the "action" element in the array. I never started with one so I can't remove it.

To be clear, this code WORKS. I have a post on my feed that is littered with "TEST: Testing comment post." comments. However, I can't stop the errors no matter what I do. I tried passing in the access_token as the first element of the array (as I saw someone do somewhere else), but that didn't change anything (didn't think it would because I'm aware that the facebook object stores the access_token internally so you don't have to pass it).

I can put a try/catch around this and continue on, but that's sloppy and doesn't allow for true errors to be handled. Unless there is a way to catch it, test the comment information in the error object is valid and then treat it as a success, but I'm looking for a solution and not a hack (though I'm getting close to a hack at this point).

Was it helpful?

Solution

This issue was fixed per developers.facebook.com/x/bugs/1475816135977009 during a release in October, 2014.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top