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
[13-Mar-2014 01:22:46 UTC] array (
'message' => 'An unknown error has occurred.',
'type' => 'OAuthException',
'code' => 1,
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
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...