处理作业时发生反序列化错误 rails
Deserialization error while processing job rails
我正在尝试使用 AWS worker 为邮件程序创建后台作业,通过覆盖设计方法
def send_devise_notification(notification, *args)
devise_mailer.send(notification, id, *args).deliver_later
end
我正在将邮件程序推送到 SQS 队列,而工作人员正在处理作业(ActiveJob::Base.execute(params)
我收到以下错误
{"job_class"=>"ActionMailer::DeliveryJob", "job_id"=>"4153057f-3811-4f41-9e90-b37187c91a91", "provider_job_id"=>nil, "queue_name"=>"DevelopmentJobs", "priority"=>nil, "arguments"=>["DeviseMailer", "reset_password_instructions", "deliver_now", 54, "3LsoHzn6F_ySZpkjefw4", {"_aj_symbol_keys"=>[]}], "executions"=>0, "locale"=>"en", "process_sqs_job"=>{"job_class"=>"ActionMailer::DeliveryJob", "job_id"=>"4153057f-3811-4f41-9e90-b37187c91a91", "provider_job_id"=>nil, "queue_name"=>"DevelopmentJobs", "priority"=>nil, "arguments"=>["DeviseMailer", "reset_password_instructions", "deliver_now", 54, "3LsoHzn6F_ySZpkjefw4", {"_aj_symbol_keys"=>[]}], "executions"=>0, "locale"=>"en"}}
I, [2018-06-05T15:03:30.055439 #23265] INFO -- : [87592310-03d0-4223-af65-292798b3da88] Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
F, [2018-06-05T15:03:30.056349 #23265] FATAL -- : [87592310-03d0-4223-af65-292798b3da88]
F, [2018-06-05T15:03:30.056453 #23265] FATAL -- : [87592310-03d0-4223-af65-292798b3da88] ActiveJob::DeserializationError (Error while trying to deserialize arguments: Can only deserialize primitive arguments: <ActionController::Parameters {"_aj_symbol_keys"=>[]} permitted: false>):
活动作业反序列化原始参数并为动作控制器参数抛出异常,在将作业传递给执行方法之前将参数更改为散列后,它处理作业
def deserialize_argument(argument)
case argument
when String
GlobalID::Locator.locate(argument) || argument
when *TYPE_WHITELIST
argument
when Array
argument.map { |arg| deserialize_argument(arg) }
when Hash
if serialized_global_id?(argument)
deserialize_global_id argument
elsif custom_serialized?(argument)
Serializers.deserialize(argument)
else
deserialize_hash(argument)
end
else
raise ArgumentError, "Can only deserialize primitive arguments: #{argument.inspect}"
end
end
我正在尝试使用 AWS worker 为邮件程序创建后台作业,通过覆盖设计方法
def send_devise_notification(notification, *args)
devise_mailer.send(notification, id, *args).deliver_later
end
我正在将邮件程序推送到 SQS 队列,而工作人员正在处理作业(ActiveJob::Base.execute(params)
我收到以下错误
{"job_class"=>"ActionMailer::DeliveryJob", "job_id"=>"4153057f-3811-4f41-9e90-b37187c91a91", "provider_job_id"=>nil, "queue_name"=>"DevelopmentJobs", "priority"=>nil, "arguments"=>["DeviseMailer", "reset_password_instructions", "deliver_now", 54, "3LsoHzn6F_ySZpkjefw4", {"_aj_symbol_keys"=>[]}], "executions"=>0, "locale"=>"en", "process_sqs_job"=>{"job_class"=>"ActionMailer::DeliveryJob", "job_id"=>"4153057f-3811-4f41-9e90-b37187c91a91", "provider_job_id"=>nil, "queue_name"=>"DevelopmentJobs", "priority"=>nil, "arguments"=>["DeviseMailer", "reset_password_instructions", "deliver_now", 54, "3LsoHzn6F_ySZpkjefw4", {"_aj_symbol_keys"=>[]}], "executions"=>0, "locale"=>"en"}}
I, [2018-06-05T15:03:30.055439 #23265] INFO -- : [87592310-03d0-4223-af65-292798b3da88] Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
F, [2018-06-05T15:03:30.056349 #23265] FATAL -- : [87592310-03d0-4223-af65-292798b3da88]
F, [2018-06-05T15:03:30.056453 #23265] FATAL -- : [87592310-03d0-4223-af65-292798b3da88] ActiveJob::DeserializationError (Error while trying to deserialize arguments: Can only deserialize primitive arguments: <ActionController::Parameters {"_aj_symbol_keys"=>[]} permitted: false>):
活动作业反序列化原始参数并为动作控制器参数抛出异常,在将作业传递给执行方法之前将参数更改为散列后,它处理作业
def deserialize_argument(argument)
case argument
when String
GlobalID::Locator.locate(argument) || argument
when *TYPE_WHITELIST
argument
when Array
argument.map { |arg| deserialize_argument(arg) }
when Hash
if serialized_global_id?(argument)
deserialize_global_id argument
elsif custom_serialized?(argument)
Serializers.deserialize(argument)
else
deserialize_hash(argument)
end
else
raise ArgumentError, "Can only deserialize primitive arguments: #{argument.inspect}"
end
end