I have this small script that gets the albums from a page. This was working fine until today I started getting this wierd error:
Uncaught OAuthException: An unknown error has occurred.\n thrown in .../base_facebook.php on line 1254
I checked other questions related to this and everyone seems to have this for different reasons. This was working fine for months and I never touched it. I also checked the App ID and Secret in case they expired or something, but the ones on the Facebook App page are still the same.
What could have happened to suddenly cause this?
I did some more debugging and the problem is occurring in the _graph()
function getting this result from Facebook:
[13-Mar-2014 01:22:46 UTC] array (
'error' =>
array (
'message' => 'An unknown error has occurred.',
'type' => 'OAuthException',
'code' => 1,
),
)
I checked the Facebook developer site here: https://developers.facebook.com/docs/graph-api/using-graph-api/#errors and Error code 1 is just described as:
Possibly a temporary issue due to downtime - retry the operation after waiting, if it occurs again, check you are requesting an existing API.
I've been having the problem all day long though! I don't think it is a temporary issue.
Finally managed to find where the issue was coming from. For some reason I was getting albums which had a null
cover photo (still no idea from where this came from, there are no visible albums without a cover photo on the facebook page!), and since I was querying the album's cover photo URL one of the queries in the batch request had a NULL relative_url
.
Typical of Facebook, instead of replying with a proper error like 'invalid relative URL' or something that helps you debug the problem, they just replied with an OAuthException
with error code 1 to the whole batch request, throwing you off course what the real problem is.
Adding a simple null check fixed the problem... if only the error was a bit more indicative of the real problem! Hope this helps someone else...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With