Bastian
Bastian

Reputation: 207

how to debug crashed SuckerPunch job in production

iam trying to run an async job with SuckerPunch, which posts some data to a REST API, and writes the response into a database. On the rails CLI and the dev environment it is working. In production, it is crashing, when the API responds with an error; when the API responds with a 200 or 201 it works as well. Since iam using the same code and data in all tests, I dont understand, what difference may cause this issue. Furthermore, the log doesnt give enough details, and I dont know how to debug it further. Would be greatful to get your two cents. How would I go forward in debugging this?

QipJob.perform_async(params, data)  
ERROR -- : Sucker Punch job error for class: 'QipJob' args: [[[1075, ["xxx", "xxx", "10.174.212.145", "Router", "Static", "routed interface", "Always"]]], {:organization=>"xxx", :object_type=>"v4Object", :action=>"add", :overwrite=>nil}]

Upvotes: 0

Views: 217

Answers (1)

mr_sudaca
mr_sudaca

Reputation: 1176

maybe you can add some extra logging to your code by adding a begin rescue block to the code, like:

 def perform(data)
   begin
     # your code
   rescue => e
     Rails.logger.error(e.message)
     Rails.logger.error(e.backtrace)
     raise e
   end
 end

and then you can look at the production log and maybe (maybe) the backtrace will lead you to the problem

Upvotes: 0

Related Questions