Closed bokmann closed 11 years ago
I dove into this issue a little more, and I'm not sure which of two projects to try to contribute a fix to. The actual exception is thrown in the gem meta_request... on line 19 of their railties file they assume that they can subscribe to all notifications, take the supplied attributes, and create an ActiveSupport::Notification from them. I'm not sure this is a reasonable assumption or not.
In your stripe_event.rb file you publish a notification with just two values, the name, and the stripe event data. When these two values land in meta_request, your two values are passed to the 5 for ActiveSupport::Notification.new, and we get the 2 for 5 error.
The solution is either to have meta_request not assume it can create an ActiveSupport::Event, or have your gem use an ActiveSupport::Notifications::Event class instead of your own custom event.
Looking futher with a goal of giving one of the two of you a pullup request.
Thanks for posting this issue. I'm traveling today but will take a look as soon as I can.
Sent from my iPhone
On Jun 16, 2013, at 14:13, David Bock notifications@github.com wrote:
I dove into this issue a little more, and I'm not sure which of two projects to try to contribute a fix to. The actual exception is thrown in the gem meta_request... on line 19 of their railties file they assume that they can subscribe to all notifications, take the supplied attributes, and create an ActiveSupport::Notification from them. I'm not sure this is a reasonable assumption or not.
In your stripe_event.rb file you publish a notification with just two values, the name, and the stripe event data. When these two values land in meta_request, your two values are passed to the 5 for ActiveSupport::Notification.new, and we get the 2 for 5 error.
The solution is either to have meta_request not assume it can create an ActiveSupport::Event, or have your gem use an ActiveSupport::Notifications::Event class instead of your own custom event.
Looking futher with a goal of giving one of the two of you a pullup request.
— Reply to this email directly or view it on GitHub.
AS::Notifications provides two methods (with differing arities) for broadcasting events to listeners so you are correct that the assumption made in meta_request does not hold in all cases. That said, AS::Notifications.publish
is not well documented so it doesn't get used very often. In previous versions, stripe_event
used AS::Notifications.instrument
, but the extra arguments were thrown away so I switched to publish
.
I think your issue on meta_request addresses the problem well, but I'm open to suggestions for solving the problem on my end. Thanks again for posting.
According to the maintainer, this issue should be fixed by meta_request 0.2.7: https://github.com/dejan/rails_panel/issues/61#issuecomment-19877221.
I'm not doing anything fancy yet, and in fact I've removed all my event subscriptions to confirm this still happens. I've tried it with the latest version of the gem as well as master, and also tried it turning off the event_retriever.
Any event I receive, for instance the attached log is from creating a plan from the test console, results in the above error. attached is the rails event and corresponding stack trace. I'm using Rails 3.2.13 and a handful of non-controvertial gems.
Any ideas?
Started POST "/api/stripe" for 127.0.0.1 at 2013-06-16 15:10:29 -0400 Processing by StripeEvent::WebhookController#event as XML Parameters: {"id"=>"evt_21pCFyxFerySHp", "created"=>1371409822, "livemode"=>false, "type"=>"plan.created", "data"=>{"object"=>{"interval"=>"month", "name"=>"1", "amount"=>999, "currency"=>"usd", "id"=>"1", "object"=>"plan", "livemode"=>false, "interval_count"=>1, "trial_period_days"=>30}}, "object"=>"event", "pending_webhooks"=>1, "request"=>"iar_21pChQ3qdCyUBS", "webhook"=>{"id"=>"evt_21pCFyxFerySHp", "created"=>1371409822, "livemode"=>false, "type"=>"plan.created", "data"=>{"object"=>{"interval"=>"month", "name"=>"1", "amount"=>999, "currency"=>"usd", "id"=>"1", "object"=>"plan", "livemode"=>false, "interval_count"=>1, "trial_period_days"=>30}}, "object"=>"event", "pending_webhooks"=>1, "request"=>"iar_21pChQ3qdCyUBS"}} Completed 500 Internal Server Error in 1ms
ArgumentError - wrong number of arguments (2 for 5): (gem) meta_request-0.2.5/lib/meta_request/railtie.rb:19:in
block (2 levels) in <class:Railtie>' (gem) activesupport-3.2.13/lib/active_support/notifications/fanout.rb:47:in
publish' (gem) activesupport-3.2.13/lib/active_support/notifications/fanout.rb:25:inblock in publish' (gem) activesupport-3.2.13/lib/active_support/notifications/fanout.rb:25:in
publish' (gem) activesupport-3.2.13/lib/active_support/notifications.rb:118:inpublish' /Users/dbock/clients/codesherpas/tracking_papers/vendor/bundle/ruby/1.9.1/bundler/gems/stripe_event-590f4ca55acb/lib/stripe_event.rb:19:in
publish' /Users/dbock/clients/codesherpas/tracking_papers/vendor/bundle/ruby/1.9.1/bundler/gems/stripe_event-590f4ca55acb/lib/stripe_event.rb:15:ininstrument' /Users/dbock/clients/codesherpas/tracking_papers/vendor/bundle/ruby/1.9.1/bundler/gems/stripe_event-590f4ca55acb/app/controllers/stripe_event/webhook_controller.rb:4:in
event' (gem) actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:4:insend_action' (gem) actionpack-3.2.13/lib/abstract_controller/base.rb:167:in
process_action' (gem) actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:inprocess_action' (gem) actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in
block in process_action' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:403:in_run__3447592120788238416__process_action__138177565787492261__callbacks' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:405:in
run_callback' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:385:in_run_process_action_callbacks' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:81:in
run_callbacks' (gem) actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:inprocess_action' (gem) actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in
process_action' (gem) actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:inblock in process_action' (gem) activesupport-3.2.13/lib/active_support/notifications.rb:123:in
block in instrument' (gem) activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:ininstrument' (gem) activesupport-3.2.13/lib/active_support/notifications.rb:123:in
instrument' (gem) actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:inprocess_action' (gem) actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in
process_action' (gem) activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:inprocess_action' (gem) actionpack-3.2.13/lib/abstract_controller/base.rb:121:in
process' (gem) actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:inprocess' (gem) actionpack-3.2.13/lib/action_controller/metal.rb:203:in
dispatch' (gem) actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:indispatch' (gem) actionpack-3.2.13/lib/action_controller/metal.rb:246:in
block in action' (gem) actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:indispatch' (gem) actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in
call' (gem) journey-1.0.4/lib/journey/router.rb:68:inblock in call' (gem) journey-1.0.4/lib/journey/router.rb:56:in
call' (gem) actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:incall' (gem) railties-3.2.13/lib/rails/engine.rb:479:in
call' (gem) railties-3.2.13/lib/rails/railtie/configurable.rb:30:inmethod_missing' (gem) journey-1.0.4/lib/journey/router.rb:68:in
block in call' (gem) journey-1.0.4/lib/journey/router.rb:56:incall' (gem) actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in
call' (gem) meta_request-0.2.5/lib/meta_request/middlewares/app_request_handler.rb:11:incall' (gem) rack-contrib-1.1.0/lib/rack/contrib/response_headers.rb:17:in
call' (gem) meta_request-0.2.5/lib/meta_request/middlewares/headers.rb:16:incall' (gem) meta_request-0.2.5/lib/meta_request/middlewares/meta_request_handler.rb:13:in
call' (gem) warden-1.2.1/lib/warden/manager.rb:35:inblock in call' (gem) warden-1.2.1/lib/warden/manager.rb:34:in
call' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:incall' (gem) rack-1.4.5/lib/rack/etag.rb:23:in
call' (gem) rack-1.4.5/lib/rack/conditionalget.rb:35:incall' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in
call' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:incall' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in
call' (gem) rack-1.4.5/lib/rack/session/abstract/id.rb:210:incontext' (gem) rack-1.4.5/lib/rack/session/abstract/id.rb:205:in
call' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:incall' (gem) activerecord-3.2.13/lib/active_record/query_cache.rb:64:in
call' (gem) activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:incall' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in
block in call' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:405:in_run__1631969465490691919__call__3364289358493390362__callbacks' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:405:in
run_callback' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:385:in_run_call_callbacks' (gem) activesupport-3.2.13/lib/active_support/callbacks.rb:81:in
run_callbacks' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:incall' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:65:in
call' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:incall' (gem) better_errors-0.7.2/lib/better_errors/middleware.rb:84:in
protected_app_call' (gem) better_errors-0.7.2/lib/better_errors/middleware.rb:79:inbetter_errors_call' (gem) better_errors-0.7.2/lib/better_errors/middleware.rb:56:in
call' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in
call' (gem) railties-3.2.13/lib/rails/rack/logger.rb:32:incall_app' (gem) railties-3.2.13/lib/rails/rack/logger.rb:16:in
block in call' (gem) activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:intagged' (gem) railties-3.2.13/lib/rails/rack/logger.rb:16:in
call' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:incall' (gem) rack-1.4.5/lib/rack/methodoverride.rb:21:in
call' (gem) rack-1.4.5/lib/rack/runtime.rb:17:incall' (gem) activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in
call' (gem) rack-1.4.5/lib/rack/lock.rb:15:incall' (gem) actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in
call' (gem) railties-3.2.13/lib/rails/engine.rb:479:incall' (gem) railties-3.2.13/lib/rails/application.rb:223:in
call' (gem) rack-1.4.5/lib/rack/content_length.rb:14:incall' (gem) railties-3.2.13/lib/rails/rack/log_tailer.rb:17:in
call' (gem) rack-1.4.5/lib/rack/handler/webrick.rb:59:inservice' /Users/dbock/.rbenv/versions/1.9.2-p320/lib/ruby/1.9.1/webrick/httpserver.rb:111:in
service' /Users/dbock/.rbenv/versions/1.9.2-p320/lib/ruby/1.9.1/webrick/httpserver.rb:70:inrun' /Users/dbock/.rbenv/versions/1.9.2-p320/lib/ruby/1.9.1/webrick/server.rb:183:in
block in start_thread'