I have been struggling with this problem all day, and I really need some input.
I have a Rails application (3.1.3) running on Heroku cedars, trying to post some Facebook Open Graph actions using gem fb_graph (2.4.0).
This is my code.
begin app = FbGraph::Application.new(ENV['facebook_app_id']) me = FbGraph::User.me(user.facebook_access_token) logger.info "Facebook: User #{user.name} reviewing game #{game_url(review.game)}" action = me.og_action!( app.og_action(:review), :game => game_url(review.game), :content => review.review, :rating => review.rating ) rescue Exception => exc logger.error "Failed to publish review #{review.id} to facebook #{user.facebook_auth}" logger.error "Facebook error msg: #{exc.message}" end
If I go to the page of my application that tries to run this code, it will not be executed with the following message.
FbGraph::InvalidRequest (Exception :: Could not retrieve data from URL.)
But if I open the Heroku console, heroku run console
and enter the code manually, it works fine.
My first thought was that game_url(review.game)
where to blame, but after adding a log message I am sure that it will return the correct URL. And since all this works, when I launch it manually through the heroku console, it confirms that the URL should be accessible and deliver the requested data.
Any feedback or experience is appreciated.
source share