by

fix FB.getLoginStatus() called before calling FB.init()

To fix this error, I had to take a second look at my FB.init code.

I had just moved a site to a new server, and started seeing the error in Chrome’s dev console. The all.js file loaded successfully, so that wasn’t the problem. I blamed Facebook for a few minutes and then spotted the problem after looking at my page’s source:

FB.init({
  appId      : '', // App ID
  channelUrl : '[an ok value]', // Channel File
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML
});

appId was blank because the server-side code that defines it could not pick an appId after the move. When appId was corrected, everything worked again. Beware of the blank appId. It happened to this guy too.