500 internal server error when posting - facebook

in the past few days I started encountering a problem while trying to post to facebook...
For information about my project, I use Unity3D with the social networking plugin from Prime31 for iOS.
Initially, the user is required to login then confirm that the app is allowed to post on the user's timeline.
This happens without flaw and I get response that everything happened properly, until I attempt to post to the timeline. Then I get a 500 internal server error.
here is the error the facebook api gives out:
response error: 500 internal server error
response text:
Response Headers:
ACCESS-CONTROL-ALLOW-ORIGIN: *
EXPIRES: Sat, 01 Jan 2000 00:00:00 GMT
CONTENT-TYPE: application/json; charset=UTF-8
WWW-AUTHENTICATE: OAuth "Facebook Platform" "unknown_error" "An unknown error has occurred."
X-FB-REV: 1102018
CONNECTION: keep-alive
PRAGMA: no-cache
CACHE-CONTROL: no-store
DATE: Thu, 30 Jan 2014 15:07:54 GMT
CONTENT-LENGTH: 87
X-FB-DEBUG: q453qH5ianbIOyeof0X0Ah0PDpAlkxW9+OxLBusy2do=
and the function i am using to post to facebook is:
Facebook.instance.postMessageWithLinkAndLinkToImage(Message, URL, URLName, ImageURL, Caption, completionHandler);
I do make sure that the user is properly logged in and that the publish permissions have been given.
There has been no code changes with the plugin and my code handling the plugin before and after this issue started to occur, so clearly there is something I am missing. Is this Facebook server's fault? I have already contacted Prime31, but they say that they are not responsible for what the Facebook api responds with.
What can cause 500 internal server error when trying to post to Facebook?
EDIT: it would seem that the postMessageWithLinkAndLinkToImage boils down to:
graphRequest( "me/feed", HTTPVerb.POST, parameters, completionHandler );

A 500 means you are basically crashing the Facebook servers when you make a request. So something definitely changed on the Facebook API that is causing this to happen.
I would check the plugin code and see where it's making the API call, then you can manually make that API call using something like curl. If it fails then contact Facebook support and see if they can point you to the right API documentation.

Related

Graph API 2.3: <id>/Likes Requires Read_Stream?

I want users to like certain posts they are looking that. To do that I call <id>/likes as a POST-method.
The user has these permissions: basic_info, public_profile, publish_actions, read_custom_friendlists, user_friends, user_photos, user_posts
I load the posts using /feed/me, which should mean that Facebook will find those posts using their ids in subsequent calls.
The traffic to likes looks like this:
POST /v2.3/123456789012345_987654321098765/likes HTTP/1.1
Accept-Encoding: gzip
Authorization: Bearer blahblah...
User-Agent: Google-HTTP-Java-Client/1.11.0-beta (gzip)
Content-Length: 0
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Host: graph.facebook.com
Connection: Keep-Alive
HTTP/1.1 400 Bad Request
Content-Type: text/javascript; charset=UTF-8
WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "(#100) Error finding the requested story"
Access-Control-Allow-Origin: *
X-FB-Rev: 1694181
Pragma: no-cache
Cache-Control: no-store
Facebook-API-Version: v2.3
Expires: Sat, 01 Jan 2000 00:00:00 GMT
X-FB-Debug: Ttvq+Mie2nN3jFdxREVlQj9pbZKanHPBUdlgNnOicrpDtOvEsrPOtoaKuQ+3w7TcG2L4lbWOLKhuDh4Zm14jlw==
Date: Fri, 17 Apr 2015 07:55:08 GMT
Connection: keep-alive
Content-Length: 99
{"error":{"message":"(#100) Error finding the requested story","type":"OAuthException","code":100}}"
I tried to make it work with Graph API Explorer. I added permission user_likes, but that didn't make it work. I added permission read_stream and suddenly it worked!
However, according to the documentation the user only needs publish_actions to like a post.
As we won't get read_stream we are stuck with what the documentation offers. Is this a bug or do we need other permissions or a different logic to make it work?
This was fixed by Facebook. Note however, that publish_actions alone won't do it for the various types of posts. E.g. if you want to like videos the user also must have the user_videos permission even though you don't want to play them.
On a further note, Facebook obviously does NOT use SO for technical things.

What is the URL for getAllSiteAccounts (REST)

I'm trying to call getAllSiteAccounts using the following URL:
https://rest.developer.yodlee.com/services/srest/restserver/v1.0/jsonsdk/SiteAccountManagement/getAllSiteAccounts
When I make the call, I get back:
oauth_error_problem=invalid_url_access&oauth_error_code=418
A 418 error code is:
STATUS_HTTP_DNS_ERROR_EXCEPTION
Problem Updating Account(418): We could not update your account because the site is experiencing technical difficulties. Please try later.
Am I using the correct URL? I know they really don't want us to use this call in evaluation mode as it could time out, but I would think I'd get back a different error if that was the case.
Thanks,
Chris
This URL is working. I tried this REST API using an external REST client and successfully got the response.
Below is the request which is being sent.
POST /services/srest/restserver/v1.0/jsonsdk/SiteAccountManagement/getAllSiteAccounts HTTP/1.1
Host: rest.developer.yodlee.com
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded
cobSessionToken=xxxxxxxxxxxxx&userSessionToken=xxxxxxxxxxxxxxxxxx
Can you test this again.

If I enable migrations "July 2013 Breaking Changes" of my app, then search user by email wouldn't work

I'm using the search graph API to search for users by email. Here's an example of how I do that:
GET https://graph.facebook.com/search?q=Sample%40gmail.com&fields=name%2clink%2ceducation%2cid%2cwork%2cabout%2cpicture&limit=2&type=user&access_token=...
Before the July 2013 Breaking Changes it was working fine. Once I enabled the breaking changes I start getting HTTP 403 saying that that the access token is not valid.
HTTP/1.1 403 Forbidden
Access-Control-Allow-Origin: *
Cache-Control: no-store
Content-Type: text/javascript; charset=UTF-8
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
WWW-Authenticate: OAuth "Facebook Platform" "insufficient_scope" "(#200) Must have a valid access_token to access this endpoint"
X-FB-Rev: 798183
X-FB-Debug: lZPVbdTmZrCo+Bde/MNEXy/halUzQx7qIDW5aiZeT0g=
Date: Mon, 29 Apr 2013 07:25:29 GMT
Connection: keep-alive
Content-Length: 120
{"error":{"message":"(#200) Must have a valid access_token to access this endpoint","type":"OAuthException","code":200}}
Once I remove the %40 (# sign) or the '.com' part from the request I get a normal HTTP 200 results. The problem is, that it's not what I'm looking for. I want to be able to search for users by email the way I was able before.
Example of requests that does work:
GET https://graph.facebook.com/search?q=Samplegmail.com&fields=name%2clink%2ceducation%2cid%2cwork%2cabout%2cpicture&limit=2&type=user&access_token=...
GET https://graph.facebook.com/search?q=Sample%40gmail&fields=name%2clink%2ceducation%2cid%2cwork%2cabout%2cpicture&limit=2&type=user&access_token=...
As 林果皞 said. This is a bug in the graph API. I filed a bug here:
https://developers.facebook.com/bugs/335452696581712
have you try FQL?
SELECT uid,username,first_name, middle_name, pic,pic_small, pic_big,
pic_square,
last_name,name,email,birthday,birthday_date,contact_email,current_address,current_location,education,hometown_location,
languages, locale,profile_url,sex,work FROM user where
contains('youremail#example.com')
Search by email works fine to me (Access token just granted basic permissions enough):
https://developers.facebook.com/tools/explorer?method=GET&path=%2Fsearch%3Fq%3Dlimkokhole%40gmail.com%26fields%3Dname%2Clink%2Ceducation%2Cid%2Cwork%2Cabout%2Cpicture%26limit%3D2%26type%3Duser
Update:
Recently Graph API explorer app already enabled "July 2013 Breaking
Changes". So the example i've shown above whouldn't work anymore.

Facebook Linter return a 200 error code

I'm trying to share to Facebook this url:
http://curation.masternewmedia.org/
or an other url of this domain:
http://curation.masternewmedia.org/p/1689258249/how-to-check-and-verify-news-info-in-real-time-from-social-media.
Facebook linter generates a 200 status code and Could not retrieve data from URL:
http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fcuration.masternewmedia.org%2F
When I curl the same url everything seems to be ok
$>> curl -I http://curation.masternewmedia.org/
HTTP/1.1 200 OK
Date: Wed, 02 May 2012 08:53:29 GMT
Server: Jetty(7.5.4.v20111024)
Content-Type: text/html;charset=UTF-8
Content-Language: en
Pragma: no-cache
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Set-Cookie: userId=e26ee613-8792-4f03-9066-52b6aa09a901;Path=/;Expires=Sat, 30-Apr-2022 08:53:31 GMT
Via: 1.1 www.scoop.it
Vary: Accept-Encoding
Can you please help me to understand how I can fix this issue?
Many thanks in advance
The issue seems to be that the Facebook scraper is seeing nothing at all in the source code of your site. This link will give you a view of what the scraper sees when it visits your site
I'm no expert, but I have a feeling there's something wrong with the object you've specified in the "type" section, i.e. topic
<meta property="og:type" content="topic"/>
Removing this made it work for me. If you have defined a custom action type and are using that, but have not yet had it approved, it might be caused by that. Anyway, it seems to be boiling down to that part.
You can see it working with the url soccerrumors.mobi/test/test.html
This is what the linter shows now:
Errors That Must Be Fixed
Object Type Not Allowed At URL: Object at URL 'http://curation.masternewmedia.org/' of type 'scoop_it:topic' is invalid because the domain 'curation.masternewmedia.org' is not allowed for the application id '165307520164712' which owns the specified object type. If you are the owner of this application, you can verify your configured 'Site Domain' at https://developers.facebook.com/apps/165307520164712.
The other url http://curation.masternewmedia.org/p/1686490068/four-great-curators-to-draw-inspiration-from shows that the og:type is scoop_it:article , and that works fine, so i guess you should be changing to scoop_it:article.
If you are using scoop.it's service then let them know of this problem.

Facebook status.get API throws 500 HTTP status code

I have an APP that calls Facebook status.get method via the REST server - restserver.php using session key method. This app works fine for most of the users, but for one user I consistently receive HTTP 500 status code. Since this doesn't have any specific Facebook error message, it is almost impossible for me to debug this.
Anyone faced a similar problem? What could be wrong with this user account? I checked the privacy options that I could think of and they look fine.
Also, for the same user, I can use friends.get method without any problem.
EDIT: I tried in Facebook forums as well, but it was of no use. Any pointers in the direction towards debugging/troubleshooting this problem are also appreciated.
EDIT: The full HTTP trace of my request is as follows. Just to be clear the same code works for other users.
REQUEST
=======================
GET /restserver.php?method=facebook.status.get&limit=1&api_key=a134957738cbd097e76bcefee86c75db&v=1.0&call_id=8cc99cec1562a71&format=JSON&session_key=747ad19e9859993f97c20355-1038949180&sig=5f597e80ad081b30c7155e9176a2aa04 HTTP/1.1
User-Agent: Pandemonium
Content-Type: application/x-www-form-urlencoded
Host: api.facebook.com
RESPONSE
=======================
HTTP/1.1 500 Internal Server Error
Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Content-type: application/json
Expires: Sat, 01 Jan 2000 00:00:00 GMT
P3P: CP="DSP LAW"
Pragma: no-cache
Set-Cookie: datr=1269479340-0545d70990e5f2db3b59176d82435f687f48a4bc69b5f11be9364; expires=Sat, 24-Mar-2012 01:09:00 GMT; path=/; domain=.facebook.com
X-Cnection: close
Date: Thu, 25 Mar 2010 01:09:32 GMT
Content-Length: 0
I had the same problem and just added the description field to my API call. When I deleted the description from my fields the server error was fixed. No idea why it can't handle the description field.
$events = $this->facebook->api('/me/events?fields=name,venue,privacy,location');
The user had already approved the status.get permissions?