craftdeer
craftdeer

Reputation: 1057

Some images uploaded through my rails-app using paperclip not appearing on heroku

I have made an app that lets users upload pictures and it works fine on my localhost but in heroku the pictures dont show. The picture stays on the heroku app for like an hour or two but then disappear (they also disappear if I click on "restart all dynos") after a few hours and says

2017-07-29T23:27:57.454817+00:00 heroku[router]: at=info method=GET path="/system/users/profileimages/000/000/003/thumb/adminimage.png?1501366211" host=my-app-75380.herokuapp.com request_id=b3eb34d9-9783-420f-9f3d-ad05fdbe5ebb fwd="207.38.188.8" dyno=web.1 connect=0ms service=7ms status=404 bytes=1902 protocol=https

When I inspect it in chrome, I get

Failed to load resource: the server responded with a status of 404 (Not Found)

Is there a limit of number of pictures you can upload on heroku apps? And do the size of the images matter? Or does it have anything to do with asset pipeline?

Upvotes: 0

Views: 71

Answers (1)

smudge
smudge

Reputation: 831

Here is a good explanation of what is happening from Heroku's documentation:

Each dyno gets its own ephemeral filesystem, with a fresh copy of the most recently deployed code. During the dyno’s lifetime its running processes can use the filesystem as a temporary scratchpad, but no files that are written are visible to processes in any other dyno and any files written will be discarded the moment the dyno is stopped or restarted. For example, this occurs any time a dyno is replaced due to application deployment and approximately once a day as part of normal dyno management.

I'd recommend following the instructions on this page to get Paperclip, Heroku, and Amazon S3 all working together.

Upvotes: 1

Related Questions