Facebook FQL query fails with January 2013 update-Collection of common programming errors

I’m trying to update an app to work with ‘January 2013 Breaking Changes’ enabled, and it looks likes part of the update is breaking my app. The update says “When getting stats about a URL from the link_stat FQL table… we will now use the canonicalized URL to fetch those stats.”

I have this in the head tags, which is what I thought determined the canonical URL:

When I comment on one of my pages with the comments plugin, the callback runs this:

    function(response) {
        var commentsQuery = FB.Data.query("SELECT comments_fbid FROM link_stat WHERE url='"+response.href+"'");
        console.log( 'commentsfbidQuery: ' + commentsfbidQuery.value[0].comments_fbid );

With the update enabled, what I see in the console is: “Uncaught TypeError: Cannot read property ‘0’ of undefined,” ie, the query isn’t returning anything. When I disable the update, it works again.

Been banging my head against this for a while, any insight hugely appreciated. January 9 is nigh 🙂

Originally posted 2013-11-19 13:18:21.