新手问题 Sidekiq 无法发送邮件,报错 "Could not find a valid mapping for nil"

firsthym · 2014年02月14日 · 2941 次阅读

出错的地方时在 devise mapping.rb 42 行 find_scope! 函数,报错"Could not find a valid mapping for nil"。

之前发邮件都比较正常,之后重启了服务器以后,就不行了。重启了 sidekiq 和 redis 都不行(rails app 也重启了)。

2014-02-14T08:16:05Z 7780 TID-1f987a Devise::Async::Backend::Sidekiq JID-324c8e8f1f9a74505782a33c INFO: start
2014-02-14T08:16:05Z 7780 TID-1f987a Devise::Async::Backend::Sidekiq JID-324c8e8f1f9a74505782a33c INFO: fail: 0.004 sec
2014-02-14T08:16:05Z 7780 TID-1f987a WARN: {"retry"=>true, "queue"=>"mailer", "class"=>"Devise::Async::Backend::Sidekiq", "args"=>["reset_password_instructions", "User", "5155441417f9233ae0000001"], "jid"=>"324c8e8f1f9a74505782a33c", "error_message"=>"Could not find a valid mapping for nil", "error_class"=>"RuntimeError", "failed_at"=>"2014-02-14T07:30:15Z", "retry_count"=>7, "retried_at"=>2014-02-14 08:16:05 UTC}
2014-02-14T08:16:05Z 7780 TID-1f987a WARN: Could not find a valid mapping for nil
2014-02-14T08:16:05Z 7780 TID-1f987a WARN: /usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mapping.rb:42:in `find_scope!'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mailers/helpers.rb:20:in `initialize_from_record'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/lib/devise/mailers/helpers.rb:15:in `devise_mail'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-2.1.2/app/mailers/devise/mailer.rb:9:in `reset_password_instructions'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.5/lib/abstract_controller/base.rb:167:in `process_action'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.5/lib/abstract_controller/base.rb:121:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionpack-3.2.5/lib/abstract_controller/rendering.rb:45:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:457:in `process'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:452:in `initialize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:439:in `new'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/actionmailer-3.2.5/lib/action_mailer/base.rb:439:in `method_missing'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/devise-async-0.5.1/lib/devise/async/backend/base.rb:15:in `perform'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/processor.rb:49:in `block (3 levels) in process'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:109:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:109:in `block in invoke'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/timeout.rb:14:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/retry_jobs.rb:50:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/logging.rb:22:in `with_context'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:114:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/middleware/chain.rb:114:in `invoke'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/processor.rb:48:in `block (2 levels) in process'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/processor.rb:87:in `stats'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/sidekiq-2.9.0/lib/sidekiq/processor.rb:47:in `block in process'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `public_send'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/celluloid-0.12.4/lib/celluloid/calls.rb:23:in `dispatch'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/celluloid-0.12.4/lib/celluloid/future.rb:18:in `block in initialize'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in `call'
/usr/local/rvm/gems/ruby-1.9.3-p327/gems/celluloid-0.12.4/lib/celluloid/internal_pool.rb:48:in `block in create'

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号