Search code examples
facebookfacebook-graph-apifacebook-comments

500 error when loading facebook comments


For some reason my facebook comments integration is not working for the last couple of days. I use a a rails app and the required meta information is loaded from my meta.haml file

%meta{:content=> '199743376733034', :property=> "fb:app_id"}
%meta{:property=> "fb:admins", :content=> 'skmvasu'}
%meta{:content=> request.url, :property=> "og:url"}
%meta{:content=> description, :property=> "og:description"}

-#  FACEBOOK meta info
- if controller.controller_name == 'live_stories' && (controller.action_name == 'show' || controller.action_name == 'embed')
    %meta{content: "book", property: "og:type"}
    %meta{content: @live_story.title, property: "og:title"}
    %meta{content: "#{request.url}/#{@live_story.cover_image}", property: "og:image"}

The Facebook sdk is initialized at my header file

# Facebook comments SDK
((d, s, id) ->
    js = undefined
    fjs = d.getElementsByTagName(s)[0]
    return  if d.getElementById(id)
    js = d.createElement(s)
    js.id = id
    js.src   "//connect.facebook.net/en_US/all.js#xfbml=1&status=0&appId=199743376733034"
    fjs.parentNode.insertBefore js, fjs
) document, "script", "facebook-jssdk"

And the comment box itself, is loaded in my details page

comments-wrapper.boxed.flat

%h5.white-bg.recommended-title
    Discussion
.wrapper
    .fb-comments{"data-colorscheme" => "light", "data-href" => "#{request.original_url}", "data-numposts" => "5"}

But when the comment box gets loaded it shows an error message that the url is unreachable. I tried debugging through the facebook debugger, but it shows a 500 error.

First I assumed that it is sending a post request while this page is rendered through GET. SO I made the change in my routes file to allow this page handle both get and post.

match '/live_stories/:id/:title' => 'live_stories#show', as: :show_with_title, via: [:get, :post]

But that didn't resolve the error either. Even the share button is not working properly and shows a 500 error. The app id and all the other information is valid. Not sure what the problem is.

I knew that Facebook's API had some issues a couple of days back, https://developers.facebook.com/status/ but I thought that issue was fixed. Is it an API issue, or am I doing something terribly wrong?

Here is a link to my app: http://mangoreader.com/live_stories/52f1eac869702d3133c70000/it's-silly-time


Solution

  • While facebook was trying to scrape the url some template was throwing an error. The issue is now resolved.