Search code examples
ruby-on-railsrubygemspaperclip

Paperclip shows missing files after a while in production only


On development, everything is working fine. i can upload an avatar, images and docs to posts and they stay there.

on production, in heroku. i can upload an avatar, image and docs. and they work and appear. however after a while, they do not show anymore and it says that the url does not exist. however, when i check the database i can see that they are stored properly.

here is my heroku log on the error:

2020-02-03T10:31:37.916790+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] ActionController::RoutingError (No route matches [GET] "/system/users/avatars/000/000/004/medium/Screenshot_2020-02-01_at_16.06.41.png"):
2020-02-03T10:31:37.916792+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a]
2020-02-03T10:31:37.916795+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] actionpack (6.0.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:36:in `call'
2020-02-03T10:31:37.916797+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] actionpack (6.0.2.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
2020-02-03T10:31:37.916800+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] railties (6.0.2.1) lib/rails/rack/logger.rb:38:in `call_app'
2020-02-03T10:31:37.916802+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] railties (6.0.2.1) lib/rails/rack/logger.rb:26:in `block in call'
2020-02-03T10:31:37.916804+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] activesupport (6.0.2.1) lib/active_support/tagged_logging.rb:80:in `block in tagged'
2020-02-03T10:31:37.916806+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] activesupport (6.0.2.1) lib/active_support/tagged_logging.rb:28:in `tagged'
2020-02-03T10:31:37.916808+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] activesupport (6.0.2.1) lib/active_support/tagged_logging.rb:80:in `tagged'
2020-02-03T10:31:37.916811+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] railties (6.0.2.1) lib/rails/rack/logger.rb:26:in `call'
2020-02-03T10:31:37.916813+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] actionpack (6.0.2.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
2020-02-03T10:31:37.916815+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] actionpack (6.0.2.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'
2020-02-03T10:31:37.916817+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] rack (2.1.2) lib/rack/method_override.rb:24:in `call'
2020-02-03T10:31:37.916819+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] rack (2.1.2) lib/rack/runtime.rb:24:in `call'
2020-02-03T10:31:37.916821+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] activesupport (6.0.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
2020-02-03T10:31:37.916823+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] actionpack (6.0.2.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
2020-02-03T10:31:37.916826+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] actionpack (6.0.2.1) lib/action_dispatch/middleware/static.rb:126:in `call'
2020-02-03T10:31:37.916828+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] rack (2.1.2) lib/rack/sendfile.rb:113:in `call'
2020-02-03T10:31:37.916830+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] actionpack (6.0.2.1) lib/action_dispatch/middleware/host_authorization.rb:77:in `call'
2020-02-03T10:31:37.916832+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] railties (6.0.2.1) lib/rails/engine.rb:526:in `call'
2020-02-03T10:31:37.916834+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] puma (4.3.1) lib/puma/configuration.rb:228:in `call'
2020-02-03T10:31:37.916837+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] puma (4.3.1) lib/puma/server.rb:681:in `handle_request'
2020-02-03T10:31:37.916839+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] puma (4.3.1) lib/puma/server.rb:472:in `process_client'
2020-02-03T10:31:37.916841+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] puma (4.3.1) lib/puma/server.rb:328:in `block in run'
2020-02-03T10:31:37.916844+00:00 app[web.1]: [5972883e-916f-43d5-842f-fb4a3898d57a] puma (4.3.1) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
2020-02-03T10:31:37.919025+00:00 heroku[router]: at=info method=GET path="/system/users/avatars/000/000/004/medium/Screenshot_2020-02-01_at_16.06.41.png?1580721331" host=fierce-spire-88971.herokuapp.com request_id=5972883e-916f-43d5-842f-fb4a3898d57a fwd="90.169.115.213" dyno=web.1 connect=1ms service=3ms status=404 bytes=1902 protocol=https

Solution

  • The issue was simply coming from the fact that i was storing the images on heroku. i hadn't set up aws. Once done everything worked perfectly.