0

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.

Exception stack trace

Any help would be appreciate!

Karen
  • 3
  • 4
  • Can you provide more information? The resque job source would be helpful as well as knowing what library you're using to make the `put` request. If you're using `Net::HTTP` and the URL is using `https` it could be as simple as https://stackoverflow.com/a/9227933/85125 - hard to say without more information. – Bart Jedrocha Dec 07 '17 at 15:02
  • @BartJedrocha I provided more information as you requested – Karen Dec 07 '17 at 17:10
  • I am using HTTParty Post and Put requests – Karen Dec 08 '17 at 18:36
  • I fixed this issue by adding HTTParty library in Post and Put requests (HTTParty.Post ()) – Karen Dec 08 '17 at 19:38

0 Answers0