4

I am using sucker_punch gem to send the email in my rails app in the background.It used to work fine, but then I suddenly got this error:

undefined method `async' for #<ActiveJob::QueueAdapters::SuckerPunchAdapter::JobWrapper:0x007f892c6c31a0>

Below is the screenshot of the full error:

enter image description here

I am using sucker_punch version 2.0.1 right now. I have tried to downgrade it and using sucker_punch version 1.6.0 instead, but the error persist.

Any help? Thanks!

Ryzal Yusoff
  • 957
  • 2
  • 22
  • 49

2 Answers2

7

Okay I have finally figured it out. In my sucker_punch.rb file, I need to include this:

# config/initializers/sucker_punch.rb

require 'sucker_punch/async_syntax'

This is required for those who are using Sucker Punch version 2.0.0+ with Rails < 5.0.0 as explained here

Ryzal Yusoff
  • 957
  • 2
  • 22
  • 49
1

They've actually changed async syntax.

With newer versions of sucker_punch, you should call async like so: Model.perform_async

It's mentioned under the Backwards Compatibility heading here https://github.com/brandonhilkert/sucker_punch

Qasim
  • 1,554
  • 1
  • 13
  • 22