Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

heroku paperclip weird error Paperclip::Errors::MissingRequiredValidatorError

Tags:

I've deployed a rails app to heroku, it was working just fine until I changed domains, locally it works fine and now I've started getting the following error: Paperclip::Errors::MissingRequiredValidatorError.

the s3 env variables are set on heroku and I can't find why this error occurs, help is appreciated.

EDIT: for future reference, it had nothing to do with heroku, once re-bundling, it'll throw the same error locally, as the answer suggest.

like image 764
Itai Sagi Avatar asked Feb 02 '14 09:02

Itai Sagi


People also ask

What kind of errors are displayed on Heroku?

Other errors, such as application errors (a 404 or 500), will display your application’s error page and not the Heroku error page. Only system-level errors that result in no response, or a malformed one, will display the Heroku error page discussed here.

What is Error 503 in Heroku?

Heroku’s HTTP router serves unstyled HTML with HTTP status code 503 (Service Unavailable) when your app encounters a system-level error, or while maintenance mode is enabled. Other errors, such as application errors (a 404 or 500), will display your application’s error page and not the Heroku error page.

Can I use Heroku as a template?

You may wish to use the default HTML served by Heroku as a template: You can reference images or CSS from the HTML as long as you use relative paths (for example, <img src="error.png">) and you upload the other assets into the same place as the HTML. You can host the pages anywhere that can serve web pages.

Why are my Heroku logs –tail session logs not catching up?

A heroku logs –tail session cannot keep up with the volume of logs generated by the application or log channel, and Logplex has discarded some log lines necessary to catch up.


1 Answers

With version 4.0 (published 2 days ago) Paperclip requires file/mime validation. Simply add the following to your model:

validates_attachment_content_type :file_name, :content_type => %w(image/jpeg image/jpg image/png) 

IMPORTANT: replace file_name and content type so that it fits your project.

It works locally because you probably have not updated paperclip yet.

like image 66
sebvst Avatar answered Oct 17 '22 08:10

sebvst