FuelSDK-Ruby icon indicating copy to clipboard operation
FuelSDK-Ruby copied to clipboard

Sidekiq : Throwing Error Message

Open puneetgaurr opened this issue 7 years ago • 0 comments

I am using Sidekiq for the background process and creat a very simple application to validate Sidekiq functionality. I am getting success response but getting failure message when calling it through sidekiq. Please help me resolve this issue.

Error Message : 2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: {"context":"Job raised exception","job":{"class":"ProcessWorker","args":["{"name"=>"Hello", "description"=>"Hello666", "author"=>"Hello"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172},"jobstr":"{"class":"ProcessWorker","args":["{\"name\"=>\"Sumit8901\", \"description\"=>\"Hello666\", \"author\"=>\"Hello7777\"}"],"retry":true,"queue":"default","jid":"866561849a5cd5336ef03cc4","created_at":1516548964.76175,"enqueued_at":1516549257.6588979,"error_message":"When assigning attributes, you must pass a hash as an argument.","error_class":"ArgumentError","failed_at":1516548964.76448,"retry_count":3,"retried_at":1516549132.7047172}"} 2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN: ArgumentError: When assigning attributes, you must pass a hash as an argument. 2018-01-21T15:40:57.662Z 73625 TID-outayy7ac WARN:

Please find the below code-

Controller class: books_controller.rb def create @job=ProcessWorker.perform_async(book_params) h = {"response" => {"job_id" => @job}} render json: h end

Worker Class:

class ProcessWorker include Sidekiq::Worker def perform(book_params) book = Book.new(book_params) book.save end end

Migrations Class: class CreateBooks < ActiveRecord::Migration[5.1] def change create_table :books do |t| t.string :name t.string :description t.string :author

  t.timestamps
end

end

puneetgaurr avatar Jan 21 '18 15:01 puneetgaurr