Jump to content

The ultimate community for Ruby on Rails developers.


How to Fix : Heroku Custom Domain failed to connect Facebook API

heroku api custom domain facebook

  • Please log in to reply
No replies to this topic

#1 Kevin



  • Members
  • 23 posts

Posted 14 August 2013 - 11:47 PM

The background problem of this post is :


I developed an application with FB-connect using Ruby On Rails on Heroku. Everything is working well until we face this problem : Everytime user clicks "Sign In with Facebook" , it returned R10 (boot timeout error). It didn't reach Facebook API at all (after I'm reading R10 docs).
However, when I take out the custom domain (www.my-app.com) , then replace www.my-app.com on developers.facebook.com with my-app.herokuapp.com --- you know what I mean... Then, I access the app through my-app.herokuapp.com , everything is working well. I can "Sign in with Facebook" correctly, without any problem.

How to solve such problem ?

To solve such problem, you need to follow all the steps below carefully and correctly.

- Open session_store.rb file under /config/initializers directory on your Rails application.
- Change to database for sessions instead of using cookie as sessions store  for your Rails application. To do this, just match the codes below with the one on yours.

# Be sure to restart your server when you modify this file.

#kevinhq::Application.config.session_store :cookie_store, :key => '_kevinhq_session'

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
kevinhq::Application.config.session_store :active_record_store

After applying such change on your Rails application, please remember to run "rails generate session_migration". That command will produce a new migration and you need to execute it with "rake db:migrate" (as usual). At last,be sure to restart your server.

*Replace kevinhq::Application with your-app-name::Application

Conclusion (so far) :
I found the root of the problem was with session store. Using cookie as session store (which is default one), cause this problem. In other words,it cause "cookie overflow" and prevent the application to reach Facebook API when running on Heroku platform (although it can reach Facebook API when running locally).



Source of this post :


  • james likes this

Also tagged with one or more of these keywords: heroku, api, custom domain, facebook

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users