Reputation: 605
I have been experiencing intermittent issues with facebook stream publishes. When a stream publish is called, the modal placeholder pops up with "Loading..." but often never loads. Since the issue comes and goes, I had always assumed facebook itself was the problem. There is no modal error message as would be expected if an invalid parameter were passed in and I don't see any failed requests or javascript errors. I don't really have any clues as to what is causing this, we just know it leads to a painfully high percentage of lost publishes.
My colleague suggests chrome is failing more consistently than other browsers, but I have seen this in every browser environment.
The code in question is in an iframe on an FBML canvas, I'm using the current and latest JS SDK. The following JS libs are in use:
Here's my wrapper for all the stream publishes the app generates:
function streamPublish(name, caption, description, icon, href, actiontext, message, recipient, properties) {
var attachment = {
'media':[{'type':'image','src':icon,'href': href}],
'name': name,
'caption': caption,
'description': description,
'href': href
};
if (properties !== undefined && properties !== ''){
attachment.properties = properties;
}
if (recipient === undefined || recipient === ''){
recipient = getUserId();
}
FB.ui({
method: 'stream.publish',
'message': message,
attachment: attachment,
action_links: [{'text':actiontext, 'href':href}],
target_id:recipient
},
function(response) {
if (response && response.post_id) {
publishSuccess(response);
} else {
publishFail();
}
});
}
This has been hurting the app for a while, any help clues would be much appreciated.
Upvotes: 2
Views: 3399
Reputation: 605
Facebook knows about the bug. It has like 2500 votes in their bug tracker.
Awesome.
http://bugs.developers.facebook.net/show_bug.cgi?id=10180
http://forum.developers.facebook.net/viewtopic.php?pid=262043#p262043
http://forum.developers.facebook.net/viewtopic.php?id=60357
http://forum.developers.facebook.net/viewtopic.php?id=60382
http://forum.developers.facebook.net/viewtopic.php?id=57404
http://github.com/facebook/connect-js/issues/#issue/65
http://github.com/facebook/connect-js/issues/#issue/72
Upvotes: 1
Reputation: 36
I suspect the problem could be during the authentication between client and server, because every other stream.publish call works except for the first.
Try setting 'cookie' to false in FB.init... I reasoned that might force the init to actually contact the server
FB.init({
...
cookie: false,
...
});
Haven't thoroughly tested it, but it seems it might just work.
UPDATE: unfortunately, it seems it won't fix it for all the cases
Upvotes: 0