webhook上的Stripe和StripeEvent错误

时间:2014-02-28 19:00:18

标签: stripe-payments

我们在webhook上遇到一些条带问题:

NoMethodError: undefined method `has_key?' for nil:NilClass

这是来自honeybadger的应用程序堆栈:

[PROJECT_ROOT]/config/initializers/stripe.rb:6:in `block (2 levels) in <top (required)>`
[PROJECT_ROOT]/lib/rack_headers.rb:70:in `_call`
[PROJECT_ROOT]/lib/rack_headers.rb:66:in `call`
[PROJECT_ROOT]/lib/unicorn_oobgc.rb:73:in `process_client`

完整追踪:

[GEM_ROOT]/gems/stripe-1.10.1/lib/stripe/stripe_object.rb:184:in `respond_to_missing?`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:313:in `respond_to?`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:313:in `init_with`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:306:in `revive`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:178:in `visit_Psych_Nodes_Mapping`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:268:in `block in revive_hash`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:266:in `each`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:266:in `each_slice`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:266:in `revive_hash`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:305:in `block in revive`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:305:in `map`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:305:in `revive`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:178:in `visit_Psych_Nodes_Mapping`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:268:in `block in revive_hash`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:266:in `each`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:266:in `each_slice`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:266:in `revive_hash`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:141:in `visit_Psych_Nodes_Mapping`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:305:in `block in revive`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:305:in `map`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:305:in `revive`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:178:in `visit_Psych_Nodes_Mapping`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:240:in `visit_Psych_Nodes_Document`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych/nodes/node.rb:35:in `to_ruby`
/usr/local/rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/psych.rb:130:in `load`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/coders/yaml_column.rb:26:in `load`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/serialization.rb:89:in `unserialize`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/serialization.rb:80:in `unserialized_value`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/serialization.rb:67:in `type_cast`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/read.rb:101:in `block in read_attribute`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/read.rb:84:in `fetch`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/read.rb:84:in `read_attribute`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/read.rb:59:in `__temp__4656471696c637`
[GEM_ROOT]/gems/activemodel-4.0.3/lib/active_model/dirty.rb:154:in `attribute_change`
[GEM_ROOT]/gems/activemodel-4.0.3/lib/active_model/dirty.rb:122:in `block in changes`
[GEM_ROOT]/gems/activemodel-4.0.3/lib/active_model/dirty.rb:122:in `map`
[GEM_ROOT]/gems/activemodel-4.0.3/lib/active_model/dirty.rb:122:in `changes`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/attribute_methods/dirty.rb:33:in `save`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/transactions.rb:270:in `block (2 levels) in save`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/transactions.rb:326:in `block in with_transaction_returning_status`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/transactions.rb:209:in `transaction`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/transactions.rb:323:in `with_transaction_returning_status`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/transactions.rb:270:in `block in save`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/transactions.rb:281:in `rollback_active_record_state!`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/transactions.rb:269:in `save`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/persistence.rb:37:in `create`
[PROJECT_ROOT]/config/initializers/stripe.rb:6:in `block (2 levels) in <top (required)>`
[GEM_ROOT]/gems/stripe_event-1.1.0/lib/stripe_event.rb:51:in `call`
[GEM_ROOT]/gems/stripe_event-1.1.0/lib/stripe_event.rb:51:in `call`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications/fanout.rb:125:in `finish`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications/fanout.rb:40:in `block in finish`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications/fanout.rb:40:in `each`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications/fanout.rb:40:in `finish`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:36:in `finish`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:25:in `instrument`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159:in `instrument`
[GEM_ROOT]/gems/stripe_event-1.1.0/lib/stripe_event.rb:22:in `instrument`
[GEM_ROOT]/gems/stripe_event-1.1.0/app/controllers/stripe_event/webhook_controller.rb:4:in `event`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/abstract_controller/base.rb:189:in `process_action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal/rendering.rb:10:in `process_action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/abstract_controller/callbacks.rb:18:in `block in process_action`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:383:in `_run__3361655071239073643__process_action__callbacks`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:80:in `run_callbacks`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/abstract_controller/callbacks.rb:17:in `process_action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal/rescue.rb:29:in `process_action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159:in `block in instrument`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159:in `instrument`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal/instrumentation.rb:30:in `process_action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal/params_wrapper.rb:245:in `process_action`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/railties/controller_runtime.rb:18:in `process_action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/abstract_controller/base.rb:136:in `process`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/abstract_controller/rendering.rb:44:in `process`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal.rb:195:in `dispatch`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal/rack_delegation.rb:13:in `dispatch`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_controller/metal.rb:231:in `block in action`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:80:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:80:in `dispatch`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:48:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:71:in `block in call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59:in `each`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:680:in `call`
[GEM_ROOT]/gems/railties-4.0.3/lib/rails/engine.rb:511:in `call`
[GEM_ROOT]/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:in `method_missing`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:71:in `block in call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59:in `each`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:680:in `call`
[GEM_ROOT]/gems/librato-rails-0.9.0/lib/librato/rack/middleware.rb:12:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/conditionalget.rb:35:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/head.rb:11:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/params_parser.rb:27:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/flash.rb:241:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/cookies.rb:486:in `call`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/query_cache.rb:36:in `call`
[GEM_ROOT]/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:373:in `_run__2785494930072994460__call__callbacks`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:80:in `run_callbacks`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/remote_ip.rb:76:in `call`
[GEM_ROOT]/gems/bugsnag-1.8.4/lib/bugsnag/rack.rb:36:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call`
[GEM_ROOT]/gems/lograge-0.2.2/lib/lograge/rails_ext/rack/logger.rb:15:in `call_app`
[GEM_ROOT]/gems/railties-4.0.3/lib/rails/rack/logger.rb:22:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/request_id.rb:21:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call`
[GEM_ROOT]/gems/activesupport-4.0.3/lib/active_support/cache/strategy/local_cache.rb:83:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/static.rb:64:in `call`
[PROJECT_ROOT]/lib/rack_headers.rb:70:in `_call`
[PROJECT_ROOT]/lib/rack_headers.rb:66:in `call`
[GEM_ROOT]/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call`
[GEM_ROOT]/gems/actionpack-4.0.3/lib/action_dispatch/middleware/ssl.rb:24:in `call`
[GEM_ROOT]/gems/railties-4.0.3/lib/rails/engine.rb:511:in `call`
[GEM_ROOT]/gems/railties-4.0.3/lib/rails/application.rb:97:in `call`
[GEM_ROOT]/gems/railties-4.0.3/lib/rails/railtie/configurable.rb:30:in `method_missing`
[GEM_ROOT]/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:572:in `process_client`
[PROJECT_ROOT]/lib/unicorn_oobgc.rb:73:in `process_client`
[GEM_ROOT]/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:666:in `worker_loop`
[GEM_ROOT]/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:521:in `spawn_missing_workers`
[GEM_ROOT]/gems/unicorn-4.8.2/lib/unicorn/http_server.rb:140:in `start`
[GEM_ROOT]/gems/unicorn-4.8.2/bin/unicorn:126:in `<top (required)>`
[GEM_ROOT]/bin/unicorn:23:in `load`
[GEM_ROOT]/bin/unicorn:23:in `<main>`

只是想知道是否有任何明显的东西适合任何人。使用的宝石是stripestripe_event

1 个答案:

答案 0 :(得分:0)

这实际上是条纹gem中的一些变化所造成的问题:

https://github.com/stripe/stripe-ruby/pull/122

在此处解决:https://github.com/stripe/stripe-ruby/pull/122