ruby on rails

Uploaded images go missing in heroku

No doubt heroku is the greatest thing since sliced bread, with easy deployment and stuff, and it is free to start with. Perfect for stingy developer like me. So I am working on a rails apps, deployed to heroku, with paperclip for image upload. Things work fine, except images I uploaded keep on missing. I thought heroku wouldn’t store image for free user, ha.

A quick search around internet, sure enough it is stackoverflow come with an answer top in the list. It turn out that only images in the commit and pushed to heroku are kept, example logo or icon used in the apps. Uploaded images will be removed with each push to heroku, clearly images uploaded via paperclip fall into the latter category.

Solution is to use a 3rd party storage, like Amazon Simple Storage Service. Of course, aws is free to start with as well, a free account includes 5Gb storage, 20k Get requests, 2k put request, yada yada, another great thing for stingy developer, hurray!

By kahfei

A system admin by day while secretly trying to transform myself to a coding designer or a designing coder at night.

9 replies on “Uploaded images go missing in heroku”

Thank you for a great tip!! Could you write a small tutorial for Heroku / Images uploading to AWS set up /process? Thank you!!

Hi Shreya, in your case do you mean you have images stored in heroku or a third party storage service?
If it is the former, then even if there is no further push to heroku, images might be lost as well, as what I found out in stackoverflow, due to dyno restart that happen occasionally.

This is two years late reply. But, hey, glad if this does help 🙂

Sorry, this reply is two years late ;-), and I haven’t used heroku for a while now. Guess you have find something useful for heroku/images uploading to AWS setup/process on the net?

Leave a Reply

Your email address will not be published. Required fields are marked *