简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM