Delayed Job fails on heroku but runs locally

I have a Delayed Job that processes a bunch of S3 objects with aws/s3. It works locally via "rake jobs:work" but it fails on Heroku with the following error:

"{Job failed to load: uninitialized constant Net::HTTP::ConnectionPool..."

I am also able to fire up the Heroku console via "heroku run console" and run the job's method with out issue. The ConnectionPool comes from aws so I have attempted to force require 'aws/s3' but it didn't help. Any ideas?

Gems: aws-sdk (1.5.6) rails (3.1.0) delayed_job (3.0.3)

Answers


It turned out that I was reusing a s3 connection from a module. The module would return an existing connection if it existed, and it created a new one if it did not. I'm not sure why it worked in my local DJ and not on the Heroku Worker as I do not think there should have been an existing connection in either environment AND the job was kicked off with a rake task in both cases, as was the worker. Anyway, after creating a new S3 connection via AWS::S3.new within the job, the problem was solved.

Hope this helps someone.


Need Your Help

In Rails, how do I create a migration that will add a column/foreign key to a table that is of the same type as that table?

postgresql ruby-on-rails-4 foreign-keys migration

I’m using Rails 4.2.3. How do I create a migration that will add column to a table that is of the same type as the table? Further, how do I add a foreign key (it is fine if the column is NULL)? I

Using Latex algorithmic package for switch statement?

algorithm latex

My googling didn't come up with how to do a switch statement in an algorithm using the algorithm and algorithmic packages, but I'm assuming you can. Most guides just didn't mention it either way.