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

constant error with 3.1.0 on NO multipart emails #54

Open
plandolt opened this issue Oct 26, 2021 · 0 comments
Open

constant error with 3.1.0 on NO multipart emails #54

plandolt opened this issue Oct 26, 2021 · 0 comments
Labels

Comments

@plandolt
Copy link

Description of the problem including expected versus actual behavior:
Constant error on no multipart message regarding not having attachments variable present. In the case the IF on https://github.com/logstash-plugins/logstash-input-imap/blob/master/lib/logstash/inputs/imap.rb#L170 is true then the variable attachments does not get set. Which is causing the error on https://github.com/logstash-plugins/logstash-input-imap/blob/master/lib/logstash/inputs/imap.rb#L213.

Steps to reproduce:

  1. use the version logstash-input-imap-3.1.0
  2. fetch a NO multipart mail
  3. check the error

Provide logs (if relevant):
2021-10-26T22:47:02,514][ERROR][logstash.inputs.imap ][xxx][0a07994cad85ba5ba7c29ee42c2cf8e414ed38435024a0cf3934c6b003696e6e] Encountered error NameError {:message=>"undefined local variable or method attachments' for #<LogStash::Inputs::IMAP:0x18e7c547>", :backtrace=>["/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.1.0/lib/logstash/inputs/imap.rb:219:in block in parse_mail'", "/usr/share/logstash/logstash-core/lib/logstash/codecs/delegator.rb:64:in block in decode'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-codec-plain-3.0.6/lib/logstash/codecs/plain.rb:35:in decode'", "/usr/share/logstash/logstash-core/lib/logstash/codecs/delegator.rb:62:in block in decode'", "org/logstash/instrument/metrics/AbstractSimpleMetricExt.java:65:in time'", "org/logstash/instrument/metrics/AbstractNamespacedMetricExt.java:64:in time'", "/usr/share/logstash/logstash-core/lib/logstash/codecs/delegator.rb:61:in decode'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.1.0/lib/logstash/inputs/imap.rb:183:in parse_mail'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.1.0/lib/logstash/inputs/imap.rb:119:in block in check_mail'", "org/jruby/RubyArray.java:1809:in each'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.1.0/lib/logstash/inputs/imap.rb:113:in block in check_mail'", "org/jruby/RubyArray.java:1851:in each_slice'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.1.0/lib/logstash/inputs/imap.rb:111:in check_mail'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.1.0/lib/logstash/inputs/imap.rb:92:in block in run'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/stud-0.0.23/lib/stud/interval.rb:20:in interval'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-input-imap-3.1.0/lib/logstash/inputs/imap.rb:91:in run'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:405:in inputworker'", "/usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:396:in `block in start_input'"]}

Possible workaround
I got it working changing https://github.com/logstash-plugins/logstash-input-imap/blob/master/lib/logstash/inputs/imap.rb#L213 to if defined?(attachments) && attachments.length > 0. But bear in mind: I really do NOT know ruby at all so this might not be the "correct" way to fix it.

@plandolt plandolt added the bug label Oct 26, 2021
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

1 participant