Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change in 2.8.2 makes airbrake crash on error when filtering array typed keys #308

Closed
jklimke opened this issue Mar 9, 2018 · 1 comment
Labels

Comments

@jklimke
Copy link

jklimke commented Mar 9, 2018

Hi,

it seems that a change applied in filter_keys does not work as expected.

i am experiencing the following error

F, [2018-03-09T12:45:24.049462 #17526] FATAL -- : [eedc719e-cfb5-48a6-80c9-ea22a55c7b08] NoMethodError (undefined method `each_key' for [2]:Array
Did you mean?  each_entry):
F, [2018-03-09T12:45:24.049534 #17526] FATAL -- : [eedc719e-cfb5-48a6-80c9-ea22a55c7b08]
F, [2018-03-09T12:45:24.049634 #17526] FATAL -- : [eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:76:in `filter_hash'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:82:in `block (2 levels) in filter_hash'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:82:in `each'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:82:in `block in filter_hash'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:76:in `each_key'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:76:in `filter_hash'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:60:in `block in call'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:60:in `each'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filters/keys_filter.rb:60:in `call'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filter_chain.rb:49:in `block in refine'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filter_chain.rb:47:in `each'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/filter_chain.rb:47:in `refine'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/notifier.rb:124:in `send_notice'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake-ruby (2.8.2) lib/airbrake-ruby/notifier.rb:48:in `notify'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake (7.2.1) lib/airbrake/rack/middleware.rb:80:in `notify_airbrake'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake (7.2.1) lib/airbrake/rack/middleware.rb:54:in `rescue in call'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] airbrake (7.2.1) lib/airbrake/rack/middleware.rb:51:in `call'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] actionpack (5.1.5) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
[eedc719e-cfb5-48a6-80c9-ea22a55c7b08] actionpack (5.1.5) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'

The following line does recursively call filter_hash also for arrays. Maybe the iterator function should then not be "each_key" but 'each' iterating over all keys and values.

hash[key].each { |h| filter_hash(h) }

@kyrylo kyrylo added the Bug label Mar 12, 2018
kyrylo added a commit that referenced this issue Mar 12, 2018
Fixes #308
(Change in 2.8.2 makes airbrake crash on error when filtering array
typed keys)

We should simply return non-hash values to make recursion stop failing.
kyrylo added a commit that referenced this issue Mar 12, 2018
Fixes #308
(Change in 2.8.2 makes airbrake crash on error when filtering array
typed keys)

We should simply return non-hash values to make recursion stop failing.
@kyrylo
Copy link
Contributor

kyrylo commented Mar 12, 2018

Thanks for reporting! The fix is released in v2.8.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants