R
Railway2y ago
bmayb

Trying to migrate from Heroku - Images in S3 bucket not showing, add new image crashes app

Hi, I am trying to migrate my Rails 7 app over from Heroku to Railway. I managed to deploy the app, migrate the DB, and set up a DB backup to S3. BUT none of my attached images (stored in S3) are showing up in the Railway-deployed app, and if I try to add a new image the app crashes. All images (existing ones and adding new images) work fine in Heroku still. I get an empty error - not very helpful: I, [2022-11-02T06:31:25.034636 #120] INFO -- : [8a1f130e-6718-4a29-9f9f-d3a27f200e35] Completed 500 Internal Server Error in 7025ms (ActiveRecord: 94.6ms | Allocations: 106325) F, [2022-11-02T06:31:25.036160 #120] FATAL -- : [8a1f130e-6718-4a29-9f9f-d3a27f200e35] [8a1f130e-6718-4a29-9f9f-d3a27f200e35] ActionView::Template::Error (convert /tmp/ActiveStorage-118-20221102-120-zx3huu.jpg[0] -auto-orient -resize 150x150> /tmp/image_processing20221102-120-yfhkye.jpg failed with error: ): [8a1f130e-6718-4a29-9f9f-d3a27f200e35] 54: <% if review.images.exists? %> [8a1f130e-6718-4a29-9f9f-d3a27f200e35] 55: <% review.images.each do |image| %> [8a1f130e-6718-4a29-9f9f-d3a27f200e35] 56: <% if review.images.attached? && image.content_type.in?(%w[image/gif image/jpeg image/png]) %> [8a1f130e-6718-4a29-9f9f-d3a27f200e35] 57: <%= link_to image_tag(review.image_as_thumbnail(image)), image, class: "img-thumbnail border-0 px-0", target: :_blank %> [8a1f130e-6718-4a29-9f9f-d3a27f200e35] 58: <% end %> [8a1f130e-6718-4a29-9f9f-d3a27f200e35] 59: <% end %> [8a1f130e-6718-4a29-9f9f-d3a27f200e35] 60: <% end %> At first I thought it was an issue with imagemagick but now I think it's the S3 storage - not 100% sure on the cause. I posted more details here but there's not much Railway knowledge yet on stackoverflow: https://stackoverflow.com/questions/74263642/why-are-images-not-working-after-migrating-rails-7-app-from-heroku-to-railway Can you help?
Stack Overflow
Why are images not working after migrating Rails 7 app from Heroku ...
I have a Rails 7 app with Postgresql database and AWS S3 image storage. It's currently deployed on Heroku and I want to migrate to Railway (https://railway.app/). I have successfully deployed the a...
1 Reply
bmayb
bmayb2y ago
Update - It seems like it's happening only for images I already uploaded. Is it possible that Heroku adds something to images uploaded to ensure they're unique, that I would have to do in the code using Railway?