SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.19k stars 405 forks source link

422 response on photo upload #234

Closed DaanWeller closed 6 years ago

DaanWeller commented 7 years ago

When uploading a photo to a server I get a 422 response in the logs, but the app doesn't respond to the error: the arrows keep rotating. I'm not really sure what the problem is, though. In the logs, it is stated that mini_magick can't process the "empty" file. This is for creating the thumbnail, right? Anyway, I guess Spina should catch this error as this might be confusing to the end user.

Thanks for making this lovely CMS!

lukaVarga commented 7 years ago

I am also getting the same error. Document upload works, image upload doesn't. Do we need to add any options in our config file? It'd be great to get some documentation on this (how to integrate it with S3, for instance, as I see it's being handled separately for S3)

falexandrou commented 7 years ago

Same here. Here's the JavaScript error thrown in the console:

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is no longer a child of this node. Perhaps it was moved in a 'blur' event handler?
    at remove (http://rails.dev:9005/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:6122:20)
    at jQuery.fn.init.detach (http://rails.dev:9005/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:6252:10)
    at $.(anonymous function).(anonymous function)._replaceFileInput (http://rails.dev:9005/assets/jquery-fileupload/jquery.fileupload.self-79c95…273d5a8955a6093f4f489dcd509c5a2cefb2b9a049d3cdb2710ec8d3.js?body=1:1057:37)
    at $.(anonymous function).(anonymous function)._replaceFileInput (http://rails.dev:9005/assets/jquery-fileupload/vendor/jquery.ui.widget.self…1e67e528eecf100716907331b4b9aa4f546bf75ef2e0529c8c03a562d.js?body=1:128:25)
    at Object.<anonymous> (http://rails.dev:9005/assets/jquery-fileupload/jquery.fileupload.self-79c95…273d5a8955a6093f4f489dcd509c5a2cefb2b9a049d3cdb2710ec8d3.js?body=1:1229:26)
    at fire (http://rails.dev:9005/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:3233:31)
    at Object.add [as done] (http://rails.dev:9005/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:3292:7)
    at Object.always (http://rails.dev:9005/assets/jquery.self-bd7ddd393353a8d2480a622e80342adf488fb6006d667e8b42e4c0073393abee.js?body=1:3401:15)
    at $.(anonymous function).(anonymous function)._onChange (http://rails.dev:9005/assets/jquery-fileupload/jquery.fileupload.self-79c95…273d5a8955a6093f4f489dcd509c5a2cefb2b9a049d3cdb2710ec8d3.js?body=1:1226:53)
    at $.(anonymous function).(anonymous function)._onChange (http://rails.dev:9005/assets/jquery-fileupload/vendor/jquery.ui.widget.self…1e67e528eecf100716907331b4b9aa4f546bf75ef2e0529c8c03a562d.js?body=1:128:25)
remove @ jquery.self-bd7ddd3….js?body=1:6122
detach @ jquery.self-bd7ddd3….js?body=1:6252
_replaceFileInput @ jquery.fileupload.self-79c952f….js?body=1:1057
(anonymous) @ jquery.ui.widget.self-92c37a4….js?body=1:128
(anonymous) @ jquery.fileupload.self-79c952f….js?body=1:1229
fire @ jquery.self-bd7ddd3….js?body=1:3233
add @ jquery.self-bd7ddd3….js?body=1:3292
always @ jquery.self-bd7ddd3….js?body=1:3401
_onChange @ jquery.fileupload.self-79c952f….js?body=1:1226
(anonymous) @ jquery.ui.widget.self-92c37a4….js?body=1:128
handlerProxy @ jquery.ui.widget.self-92c37a4….js?body=1:439
dispatch @ jquery.self-bd7ddd3….js?body=1:5227
elemData.handle @ jquery.self-bd7ddd3….js?body=1:4879

For image uploads, the file doesn't get at all updated. Document uploads are getting processed but this error is thrown after the upload

falexandrou commented 7 years ago

@DaanWeller @lukaVarga I did some research. The problem is two-fold.

First, my ImageMagick installation was broken so I re-installed ImageMagick.

The empty error issue is originated from carrierwave, check this issue. What happens here, is that carrierwave swallows the exception message due to a missing i18n translation.

Second, I found out that though the image got successfully uploaded after I reinstalled ImageMagick, the list wouldn't refresh due to the JavaScript error above. I'm guessing it's some kind of race condition and perhaps the uploader element gets removed before the process is finished, but this needs more investigation

oryowen commented 6 years ago

Has there been any progress on this? Seeing this error here as well. Documents upload fine. Images fail every time.

Completed 422 Unprocessable Entity in 17ms (ActiveRecord: 1.1ms)

ActiveRecord::RecordInvalid (Validation failed: File Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: ImageMagick/GraphicsMagick is not installed, File can't be blank):