Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Paperclip on Heroku

I am building my first app on Heroku and learning how to use rails simultaneously. I have built a very simple Model, and added a 'Paperclip' gem to my build. It works on my localhost (although it doesn't seem to upload files), however when deployed on Heroku, on the 'new' form I just get:

We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

I can't seem to figure out where to begin debugging this. My Gemfile contains the line gem 'paperclip'

like image 367
cjm2671 Avatar asked Feb 26 '23 06:02

cjm2671


2 Answers

Heroku logs doesn't always help.

For your purposes since you're just getting started I would recommend setting your heroku app to "development" mode so you can see verbose error messages.

heroku config # Should return a list of your current environment, including RACK_ENV=production
heroku config:add RACK_ENV=development # now you'll get verbose error messages
heroku config:add RACK_ENV=production # set this back when you're done debugging

That should help! Share the error message with us and maybe we can help more.

like image 79
Andrew Avatar answered Mar 08 '23 07:03

Andrew


Heroku has a read-only filesystem. That means Paperclip cannot save uploaded files to any place within Heroku.

If you would like to be able to upload files to an application hosted on Heroku, then you must either store the files as binary blobs within your database or you must use a separate service to store the files. If you are looking for a separate service, Paperclip has built-in support for integrating with Amazon S3.

See the relevant Heroku docs.

like image 28
yfeldblum Avatar answered Mar 08 '23 08:03

yfeldblum