使用 Sidekiq 排队电子邮件时出错

Error while queueing an email with Sidekiq

使用 deliver_later 以 sidekiq 作为队列发送电子邮件时。我收到此错误:

ActiveJob::DeserializationError: Error while trying to deserialize arguments: fe_sendauth: no password supplied

在控制台中使用 deliver_now 可以毫无问题地发送完全相同的电子邮件。

有什么想法吗?

需要 RACK_ENV 环境变量(除了 RAILS_ENV)。

因此,对于生产:

export RACK_ENV=production

fe_sendauth: no password supplied 是来自 postgresql 的身份验证错误。当您将接收模型作为参数的作业排入队列时,它将使用 globalid(类似于 "gid://app/Person/1")序列化对象,当它尝试 运行 作业时,它将反序列化该作业(基本上会做 Person.find(1)).从您拥有工作人员的服务器 运行ning 您无法使用给定的凭据连接到数据库。