You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm trying to integrate ahoy_email with mailkick and running into a SystemStackError: stack level too deep error.
My mailer code is simple:
classAdminMailer < ApplicationMailer# ...defgenerated_recommendations(recommendations)@recommendations=recommendationsmail(subject: "Recommendations generated for #{Date.today.strftime("%Y-%m-%d")}")endend
Before it crashes, the stack trace looks like this:
--> #0 Mailkick::Mailer.mail(headers#Hash, &block#NilClass)
at /home/mike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mailkick-0.1.4/lib/mailkick/mailer.rb:4
#1 AhoyEmail::Mailer.mail_with_ahoy(headers#Hash, &block#NilClass)
at /home/mike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ahoy_email-0.3.0/lib/ahoy_email/mailer.rb:27
#2 Mailkick::Mailer.mail(headers#Hash, &block#NilClass)
at /home/mike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mailkick-0.1.4/lib/mailkick/mailer.rb:4
#3 AhoyEmail::Mailer.mail_with_ahoy(headers#Hash, &block#NilClass)
at /home/mike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/ahoy_email-0.3.0/lib/ahoy_email/mailer.rb:27
#4 Mailkick::Mailer.mail(headers#Hash, &block#NilClass)
at /home/mike/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/mailkick-0.1.4/lib/mailkick/mailer.rb:4
...
It looks like each gem calls the mail method in the other (or mail_with_ahoy in this case). I traced through it with byebug and the relevant Mailkick code is (see line with ***)
moduleMailkickmoduleMailerdefmail(headers={}, &block)message=super# *** This ends up calling AhoyEmail::Mailer.mail_with_ahoyMailkick::Processor.new(message).processmessageendendend
and the relevant AhoyEmail code is (see ***)
moduleAhoyEmailmoduleMailerdefself.included(base)base.extendClassMethodsbase.class_evaldo# ...alias_method_chain:mail,:ahoyendendmoduleClassMethods# ...defmail_with_ahoy(headers={}, &block)# this mimics what original method does returnmessageif@_mail_was_called && headers.blank? && !blockmessage=mail_without_ahoy(headers, &block)# *** This calls Mailkick::Mailer.mailAhoyEmail::Processor.new(message,self).processmessageendendend
Has anyone run into this problem before? To me it looks like the gems conflict and I don't see an obvious workaround. I was surprised since Mailkick is referenced in the Readme, so I was thinking I may be missing something obvious.
The text was updated successfully, but these errors were encountered:
Hello, I'm trying to integrate ahoy_email with mailkick and running into a
SystemStackError: stack level too deep
error.My mailer code is simple:
Before it crashes, the stack trace looks like this:
It looks like each gem calls the
mail
method in the other (ormail_with_ahoy
in this case). I traced through it with byebug and the relevant Mailkick code is (see line with ***)and the relevant AhoyEmail code is (see ***)
Has anyone run into this problem before? To me it looks like the gems conflict and I don't see an obvious workaround. I was surprised since Mailkick is referenced in the Readme, so I was thinking I may be missing something obvious.
The text was updated successfully, but these errors were encountered: