I am using the quimby gem to interface with foursquare’s venue api. I have an establishment model, I am trying to run a method that looks up an establishment on foursquare so that I can then do stuff with the data 4sq provides.
in my establishment model I’ve created this method
def find_on_foursquare
Foursquare.verbose = true
foursquare = Foursquare::Base.new(FOURSQUARE_ID, FOURSQUARE_SECRET)
begin
venue = foursquare.venues.search(:ll => "#{self.lat},#{self.long}",
:query => self.name,
:categoryId => '4d4b7105d754a06374d81259')['nearby'][0]
puts venue
rescue
puts 'FAILED!'
end
end
when I execute this from localhost console everything runs smoothly. However, when I push to heroku and try to execute from heroku console it fails with “! Internal server error”
Any ideas what I am doing wrong and/or how to debug this?
Some curious lines from the heroku logs:
2011-12-29T17:09:29+00:00 app[web.1]: [foursquare] GET https://api.foursquare.com/v2/venues/search
2011-12-29T17:09:29+00:00 app[web.1]: [foursquare] PARAMS: {"ll"=>"42.344432,-71.098326", "query"=>"Citizen", "categoryId"=>"4d4b7105d754a06374d81259"}
2011-12-29T17:09:29+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/typhoeus-0.3.3/lib/typhoeus/easy.rb:397: [BUG] Segmentation fault
2011-12-29T17:09:29+00:00 app[web.1]: ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
Solution: I had to downgrade Typhoeus to 0.2.4 to get the Quimby gem to talk to Foursquare when deployed on Heroku. Working perfectly now.