jozecuervo
jozecuervo

Reputation: 605

Facebook Stream Publish Issue: Modal stuck "loading..."

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:

  • Google analytics
  • Facebook SDK
  • swfobject
  • Jquery 1.4.2
  • Jquery dump plugin
  • facebox
  • ba-debug

    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

  • Answers (2)

    Ivko Maksimovic
    Ivko Maksimovic

    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

    Related Questions