Realtime updates internal server error on Heroku using Koala
Asked Answered
S

1

0

I'm trying to generate a realtime updates subscription using the Koala gem deployed on Heroku. However, when I run the following:

@updates = Koala::Facebook::RealtimeUpdates.new(:app_id => APP_ID, :secret => APP_SECRET) @updates.subscribe("user", "feed", CALLBACK_URL, VERIFY_TOKEN)

at the heroku console, I get:

 !   Internal server error

However, when I check my Heroku logs, I don't see a 500 error. In fact, everything seems hunky-dori:

heroku[router]: GET blah-blah-760.heroku.com/facebook_updates/ dyno=web.1 queue=0 wait=0ms service=5951ms status=200 bytes=10

heroku[nginx]: 66.220.149.250 - - [05/Oct/2011:11:55:11 -0700] "GET /facebook_updates/?hub.mode=subscribe&hub.challenge=1234567890&hub.verify_token=XXXXXXX HTTP/1.0" 200 10 "-" "facebookplatform/1.0 (+http://developers.facebook.com)" blah-blah-760.heroku.com

When I paste the GET request into the browser, it echoes the hub.challenge parameter correctly.

My controller is as follows:

class FacebookUpdatesController < ApplicationController

  layout nil

  def index #this method responds to the Facebook GET 
    logger.info "about to meet challenge"
    render :text => Koala::Facebook::RealtimeUpdates.meet_challenge(params, VERIFY_TOKEN)
  end

  def create #this method responds to POST messages
    logger.info params
  end

end

My routes are configured as follows:

resources :facebook_updates, :only => [:create, :index]

I feel like I'm really close. Any help would be greatly appreciated.

Southeastwardly answered 5/10, 2011 at 19:13 Comment(1)
I also tried using an :app_access_token for the @updates = Koala::Facebook::RealtimeUpdates.new(:app_id => APP_ID, :app_access_token => APP_TOKEN) instantiation with the same results.Southeastwardly
I
0

It can't handle the both requests at the same time, if you run the @updates.subscribe("user", "feed", CALLBACK_URL, VERIFY_TOKEN) at a local console it will work.

Imprint answered 9/10, 2011 at 17:29 Comment(2)
Thanks a million, pjaspers, that was it. I was under the impression that I need to make the subscription from the production environment. The local console approach was key.Southeastwardly
And what if I want to make the subscription dynamically?Crigger

© 2022 - 2024 — McMap. All rights reserved.