I'm using Resque/redis on heroku to send emails as a background job. Once I run manually Resque.enqueue(EmailSender::Email, 'send_welcome_email',345673)
on rails console, I got EOFError: end of file reached and when I dig into the stack trace I found out that the issue starts once the job calls
response = put(url,
:body => {
:id => message_id,
:defaultAttributes => default_attributes,
:recipients => [{
:emailAddress => email
}]
}.to_json,
:headers => {
"Content-Type" => 'application/json',
"Authorization" => "Bearer #{authorization['access_token']}",
})
url = "https://api.harmony.epsilon.com/v2/messages/#{message_id}/send"
I run the request with Postman and it is working fine.
It is a weird problem and I am curious to understand why this issue is happening only when I called Resque but when I run the method itself on rails console, everything is working properly.
Any help would be appreciate!