I am seeing something odd in my Rails app, which is using a gem / blog engine called Line for blog posts. In those blog posts, you can upload images in line, and those images are stored in a table LinesPicture
.
Everything is fine locally, and it works when I push live to Heroku. In other words, I can write three blogs with pictures in each blog post, those images are stored in LinesPicture
table, and they load normally.
Then, if I push anything from local branch to Heroku thereafter, the images no longer show in the post and the error [Alt Text]
comes instead.
Checking the source of the post, it is still linked to the internal image file:
<div class="article_content">
<p><p><img src="/uploads/lines/picture/image/5/aac_divisions.png" alt="Alt Text"/></p>
I assumed this meant the image was no longer in the table, but if I run heroku run rails console
and then LinesPicture.last
, the image is definitely still there:
LinesPicture.last
LinesPicture Load (1.2ms) SELECT "lines_pictures".* FROM "lines_pictures" ORDER BY "lines_pictures"."id" DESC LIMIT 1
=> #<LinesPicture id: 5, image: "aac_divisions.png", name: "Aac Divisions", article_id: 1, created_at: "2017-08-19 21:15:42", updated_at: "2017-08-19 21:15:48">
So in short, the image is loading, subsequent pushes are causing an issue, and yet the image file ("aac_divisions.png") is still stored in the table.
Last step, I tried running heroku logs
but didn't see anything useful. Concludes with:
request_id=5d89a754-429a-46f8-9238-52f1108849ed fwd="98.234.48.100" dyno=web.1 connect=1ms service=20ms status=404 bytes=1829 protocol=https
2017-08-19T21:38:08.487398+00:00 heroku[router]: at=info method=GET path="/uploads/lines/picture/image/5/aac_divisions.png" host=quiet-coast-71929.herokuapp.com request_id=a6af52fa-a86d-4008-a924-6e68a307b9af fwd="98.234.48.100" dyno=web.1 connect=0ms service=22ms status=404 bytes=1829 protocol=https
2017-08-19T21:41:52.151184+00:00 heroku[run.8811]: State changed from up to complete
2017-08-19T21:41:52.138358+00:00 heroku[run.8811]: Process exited with status 0
Any idea why this might happen?