Aaron Russell
2008-Feb-08 00:16 UTC
[Facebooker-talk] Error calling session.send_invitation
Having some problems with the following code: @session = session[:facebook_session] user_ids = params[:ids] invitation_type = "foo" content = "bar" image_url = "quux" @session.send_invitation(user_ids,invitation_type,content,image_url) It''s dying with this: NoMethodError (You have a nil object when you didn''t expect it! The error occurred while evaluating nil.new): /vendor/plugins/facebooker/lib/facebooker/parser.rb:332:in `process'' /vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in `parse'' /vendor/plugins/facebooker/lib/facebooker/service.rb:13:in `post'' /vendor/plugins/facebooker/lib/facebooker/session.rb:329:in `post'' /vendor/plugins/facebooker/lib/facebooker/session.rb:389:in `send_request_or_invitation'' /vendor/plugins/facebooker/lib/facebooker/session.rb:268:in `send_invitation'' /app/controllers/pages_controller.rb:14:in `send_invite'' I''m guessing I''m calling send_invitation incorrectly, but I''m confused about how...
David Clements
2008-Feb-08 00:27 UTC
[Facebooker-talk] Error calling session.send_invitation
Don''t know off the top of my head what might be wrong with your code, I seem to remember that the URL needs to be valid. But anyway the code is blowing up because we are not finding the error code in our list of error codes. BTW: Looks like your version of Facebooker might be out of date? Line 332 for me is part of a hash assignment and doesn''t have the line I think you are blowing up on. raise EXCEPTIONS[Integer(hash[''error_code''])].new(hash[''error_msg'']) Can you add some debug info into process method on the parser right before it blows up? It would be great to know what that error code is. Thanks, Dave On Feb 7, 2008 5:16 PM, Aaron Russell <arussell at gmail.com> wrote:> Having some problems with the following code: > > @session = session[:facebook_session] > user_ids = params[:ids] > invitation_type = "foo" > content = "bar" > image_url = "quux" > @session.send_invitation(user_ids,invitation_type,content,image_url) > > It''s dying with this: > > NoMethodError (You have a nil object when you didn''t expect it! > The error occurred while evaluating nil.new): > /vendor/plugins/facebooker/lib/facebooker/parser.rb:332:in `process'' > /vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in `parse'' > /vendor/plugins/facebooker/lib/facebooker/service.rb:13:in `post'' > /vendor/plugins/facebooker/lib/facebooker/session.rb:329:in `post'' > /vendor/plugins/facebooker/lib/facebooker/session.rb:389:in > `send_request_or_invitation'' > /vendor/plugins/facebooker/lib/facebooker/session.rb:268:in > `send_invitation'' > /app/controllers/pages_controller.rb:14:in `send_invite'' > > I''m guessing I''m calling send_invitation incorrectly, but I''m confused > about how... > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk >
David Clements
2008-Feb-08 15:55 UTC
[Facebooker-talk] Error calling session.send_invitation
Hey Aaron, Can you update your facebooker codebase. This method was removed from the facebook API : http://wiki.developers.facebook.com/index.php/Notifications.sendRequest I think there have been some updates made by mike recently regarding this. CC the list so that all can benefit. Dave On Feb 8, 2008 7:51 AM, Aaron Russell <arussell at gmail.com> wrote:> That seems to have dumped out the contents of hash nicely: > > --- > error_msg: Unknown method > request_args: > - value: MyApp > key: type > - value: MyContent > key: content > - value: "true" > key: invitation > - value: facebook.notifications.sendRequest > key: method > - value: (redacted) > key: api_key > - value: "1202482140.24332" > key: call_id > - value: (redacted) > key: sig > - value: http://photos-b.ak.facebook.com/someimage.gif > key: image > - value: "1.0" > key: v > - value: (redacted) > key: session_key > - value: "23946" > key: to_ids > error_code: "3" > > > > On Feb 8, 2008 3:18 AM, David Clements <digidigo at gmail.com> wrote: > > You can try RAILS_DEFAULT_LOGGER.error(hash.to_yaml) > > > > That should spit it out to development.log > > > > Dave > > > > > > > > > > On Feb 7, 2008 6:23 PM, Aaron Russell <arussell at gmail.com> wrote: > > > That is actually the line I''m blowing up on. > > > > > > I''m new to Rails and Ruby, so I''m not entirely sure how to get the > > > information out. I tried "puts hash" but I have no idea where STDOUT is > > > actually pointing to. I''m guessing there''s a more sensible way of getting > > > this information than just adding "puts varname", though. > > > > > > > > > > > > On Feb 8, 2008 12:27 AM, David Clements <digidigo at gmail.com> wrote: > > > > Don''t know off the top of my head what might be wrong with your code, > > > > I seem to remember that the URL needs to be valid. > > > > > > > > But anyway the code is blowing up because we are not finding the error > > > > code in our list of error codes. > > > > > > > > BTW: Looks like your version of Facebooker might be out of date? Line > > > > 332 for me is part of a hash assignment and doesn''t have the line I > > > > think you are blowing up on. > > > > > > > > raise > > > EXCEPTIONS[Integer(hash[''error_code''])].new(hash[''error_msg'']) > > > > > > > > > > > > Can you add some debug info into process method on the parser right > > > > before it blows up? It would be great to know what that error code > > > > is. > > > > > > > > > > > > Thanks, > > > > Dave > > > > > > > > > > > > > > > > > > > > > > > > On Feb 7, 2008 5:16 PM, Aaron Russell <arussell at gmail.com> wrote: > > > > > Having some problems with the following code: > > > > > > > > > > @session = session[:facebook_session] > > > > > user_ids = params[:ids] > > > > > invitation_type = "foo" > > > > > content = "bar" > > > > > image_url = "quux" > > > > > @session.send_invitation(user_ids,invitation_type,content,image_url) > > > > > > > > > > It''s dying with this: > > > > > > > > > > NoMethodError (You have a nil object when you didn''t expect it! > > > > > The error occurred while evaluating nil.new): > > > > > /vendor/plugins/facebooker/lib/facebooker/parser.rb:332:in `process'' > > > > > /vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in `parse'' > > > > > /vendor/plugins/facebooker/lib/facebooker/service.rb:13:in `post'' > > > > > /vendor/plugins/facebooker/lib/facebooker/session.rb:329:in `post'' > > > > > /vendor/plugins/facebooker/lib/facebooker/session.rb:389:in > > > > > `send_request_or_invitation'' > > > > > /vendor/plugins/facebooker/lib/facebooker/session.rb:268:in > > > > > `send_invitation'' > > > > > /app/controllers/pages_controller.rb:14:in `send_invite'' > > > > > > > > > > I''m guessing I''m calling send_invitation incorrectly, but I''m confused > > > > > about how... > > > > > _______________________________________________ > > > > > Facebooker-talk mailing list > > > > > Facebooker-talk at rubyforge.org > > > > > http://rubyforge.org/mailman/listinfo/facebooker-talk > > > > > > > > > > > > > > > > > >
Hi Guys, I posted some code a while ago to log facebook rest calls, I cant think of a good way to put this into facebooker without adding rails dependency, but it seems like it would be helpful. Does anyone have any ideas, where we can get good rest call logging in dev but nothing in prod. I know you are trying to keep facebooker pure ruby and this method is in the ruby part (not the rails part). Is there a standard logger for ruby that everyone uses (like log4j in the java world)? Here is my version with rails logger: (in Service class change the post method to: ) def post(params) logger.debug "About to post to :" + url.to_s logger.debug "with params:" params.each { |elem| logger.debug elem[0].to_s + " : " + elem[1].to_s} resp,data = Net::HTTP.post_form(url, params) logger.debug "Result: " + resp.to_s logger.debug "Response Data: " + data.to_s Parser.parse(params[:method],resp) end thanks Joel On Feb 8, 2008, at 10:55 AM, David Clements wrote:> Hey Aaron, > > Can you update your facebooker codebase. This method was removed from > the facebook API : > http://wiki.developers.facebook.com/index.php/ > Notifications.sendRequest > > I think there have been some updates made by mike recently regarding > this. > > > CC the list so that all can benefit. > Dave > > On Feb 8, 2008 7:51 AM, Aaron Russell <arussell at gmail.com> wrote: >> That seems to have dumped out the contents of hash nicely: >> >> --- >> error_msg: Unknown method >> request_args: >> - value: MyApp >> key: type >> - value: MyContent >> key: content >> - value: "true" >> key: invitation >> - value: facebook.notifications.sendRequest >> key: method >> - value: (redacted) >> key: api_key >> - value: "1202482140.24332" >> key: call_id >> - value: (redacted) >> key: sig >> - value: http://photos-b.ak.facebook.com/someimage.gif >> key: image >> - value: "1.0" >> key: v >> - value: (redacted) >> key: session_key >> - value: "23946" >> key: to_ids >> error_code: "3" >> >> >> >> On Feb 8, 2008 3:18 AM, David Clements <digidigo at gmail.com> wrote: >>> You can try RAILS_DEFAULT_LOGGER.error(hash.to_yaml) >>> >>> That should spit it out to development.log >>> >>> Dave >>> >>> >>> >>> >>> On Feb 7, 2008 6:23 PM, Aaron Russell <arussell at gmail.com> wrote: >>>> That is actually the line I''m blowing up on. >>>> >>>> I''m new to Rails and Ruby, so I''m not entirely sure how to get the >>>> information out. I tried "puts hash" but I have no idea where >>>> STDOUT is >>>> actually pointing to. I''m guessing there''s a more sensible way of >>>> getting >>>> this information than just adding "puts varname", though. >>>> >>>> >>>> >>>> On Feb 8, 2008 12:27 AM, David Clements <digidigo at gmail.com> wrote: >>>>> Don''t know off the top of my head what might be wrong with your >>>>> code, >>>>> I seem to remember that the URL needs to be valid. >>>>> >>>>> But anyway the code is blowing up because we are not finding the >>>>> error >>>>> code in our list of error codes. >>>>> >>>>> BTW: Looks like your version of Facebooker might be out of >>>>> date? Line >>>>> 332 for me is part of a hash assignment and doesn''t have the >>>>> line I >>>>> think you are blowing up on. >>>>> >>>>> raise >>>> EXCEPTIONS[Integer(hash[''error_code''])].new(hash[''error_msg'']) >>>>> >>>>> >>>>> Can you add some debug info into process method on the parser >>>>> right >>>>> before it blows up? It would be great to know what that error >>>>> code >>>>> is. >>>>> >>>>> >>>>> Thanks, >>>>> Dave >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On Feb 7, 2008 5:16 PM, Aaron Russell <arussell at gmail.com> wrote: >>>>>> Having some problems with the following code: >>>>>> >>>>>> @session = session[:facebook_session] >>>>>> user_ids = params[:ids] >>>>>> invitation_type = "foo" >>>>>> content = "bar" >>>>>> image_url = "quux" >>>>>> @session >>>>>> .send_invitation(user_ids,invitation_type,content,image_url) >>>>>> >>>>>> It''s dying with this: >>>>>> >>>>>> NoMethodError (You have a nil object when you didn''t expect it! >>>>>> The error occurred while evaluating nil.new): >>>>>> /vendor/plugins/facebooker/lib/facebooker/parser.rb:332:in >>>>>> `process'' >>>>>> /vendor/plugins/facebooker/lib/facebooker/parser.rb:15:in >>>>>> `parse'' >>>>>> /vendor/plugins/facebooker/lib/facebooker/service.rb:13:in >>>>>> `post'' >>>>>> /vendor/plugins/facebooker/lib/facebooker/session.rb:329:in >>>>>> `post'' >>>>>> /vendor/plugins/facebooker/lib/facebooker/session.rb:389:in >>>>>> `send_request_or_invitation'' >>>>>> /vendor/plugins/facebooker/lib/facebooker/session.rb:268:in >>>>>> `send_invitation'' >>>>>> /app/controllers/pages_controller.rb:14:in `send_invite'' >>>>>> >>>>>> I''m guessing I''m calling send_invitation incorrectly, but I''m >>>>>> confused >>>>>> about how... >>>>>> _______________________________________________ >>>>>> Facebooker-talk mailing list >>>>>> Facebooker-talk at rubyforge.org >>>>>> http://rubyforge.org/mailman/listinfo/facebooker-talk >>>>>> >>>>> >>>> >>>> >>> >> > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk