Uploading video file returns "Sorry, there was an error uploading that file. Please try again."

I set params: upload_size: 500m in app.yml. Tried uploading a 153MB mp4 video and got the error message “Sorry, there was an error uploading that file. Please try again.” A 26.5MB mp4 video file uploads fine.

Checking the nginx conf file inside the docker container it is properly set to 500m.

When uploading the larger file, after reaching 100% transferred the %cpu on the discourse process jumps to 100%. Site is currently running on a Digital Ocean 8GB droplet.

from production.log

Started POST "/" for 108.253.248.44 at 2017-09-28 16:39:20 +0000
ActionController::RoutingError (No route matches [POST] "/")
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-5.1.3/lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call'
Processing by ExceptionsController#not_found as HTML
  Parameters: {"RqRfk4mdN 9R2KtxVgGadDi0dwSNjAoyhViUJ07IhBlL74e8J6xNTDDONCo HBYPeVWcif9pCCcbgNjnaSN6QgVssKK1MlrIW9duc0rE0iVEc W2qi71kf6IBA7jGmTcszkhQuqBwIPVMzm6aK15K0apyjW/W/jyVndjZt3iagmPbYAPjCL L0Z0PhfXxBcfUDVsi3EQWlyfhO kHe8KqcGyXiy2O537tTTU8ZE1vFaDPgVPNRHqFyBZaIa1tgy571S 1x8Trha8xI8KEXEnNSniWIX1yLnVCN6kgPvr qDiaco2aWXUfTwaWSHX7GmCkoaKnNFDK8uPVmdJ7Ja9EZrckhI  gTCMYiP7TSXxR0Mf/TpuDxPFhByAiV "=>nil}
Can't verify CSRF token authenticity.
  Rendering text template
  Rendered text template (0.0ms)
Filter chain halted as :verify_authenticity_token rendered or redirected
Completed 403 Forbidden in 2ms (Views: 0.8ms | ActiveRecord: 0.0ms)

from nginx/error.log

2017/09/28 16:38:00 [error] 56#56: *1022 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 134.xx.xx.xx, server: _, request: "POST /uploads.json?client_id=b629035fddbd408685a5e3c6b20da7d5&authenticity_token=u8Ws4JUFBBixpknfPfwkq9YprQVIwjIPie4yrlfao9KgkAPLE2rpdxxnjm556OpW55XlBWHR%2B4OMEBuoyusPPA%3D%3D HTTP/1.1", upstream: "http://127.0.0.1:3000/uploads.json?client_id=b629035fddbd408685a5e3c6b20da7d5&authenticity_token=u8Ws4JUFBBixpknfPfwkq9YprQVIwjIPie4yrlfao9KgkAPLE2rpdxxnjm556OpW55XlBWHR%2B4OMEBuoyusPPA%3D%3D", host: "174.138.109.18", referrer: "http://174.138.109.18/t/put-some-test-videos-here/13/27"`

Suggestions? I am trying to setup a site where students can submit videos for review and other students can comment on those videos with video. Unfortunately the use case doesn’t lend itself well to uploading to dropbox or youtube as the student work needs to be kept private and the class frequently uploads the movies directly from iOS devices lended out to them by our college so setting up Dropbox each time the devices were checked out won’t work.

And if there is a better platform to handle this amount of video feel free to chime in. I’m open to anything.

5 Likes

Discourse isn’t oriented towards giant video sharing tasks. We recommend uploading those videos to Vimeo, or YouTube, or similar.

Is there anything we could do to make this use case work better though @zogstrip? I’m unsure.

1 Like

YouTube is a great solution to this though… as they can upload natively via the YouTube app and default to private so the video isn’t public and is only shared when embedded into your community site. It’s entirely free and the delivery / speed is top-notch.

Is there anything missing from the workflow that would preclude YT? I use this exact workflow for videos I make for my moderating team.

6 Likes

I did a proof of concept for someone needing to upload videos at a university (in a former life I was an instructional technology professor at a decent state university). If you keep the videos small enough you can make it work. As I recall, it was trouble upping the limit, but I got it to where I think it was good enough.

And if videos are longer than 5 minutes no one is going to watch them, so there’s no point in uploading the video anyway.

5 Likes

On the server side, not sure what to do about the connection reset.

On the client side, we could show a warning to let the user know that it’s probably better to use YouTube or similar to handle the video upload and just post a link here instead.

4 Likes

Thank you for all the feedback. Trying out YouTube as a solution, the 20 minute test video took about 8 minutes to compress, transfer to YouTube, convert, and be pasted into Discourse – directly from iOS. Not bad in my opinion. The only downside is the YouTube sign in and having to share a single Google account/YouTube login credentials with everyone in the class.

It would be great if you could integrate the YouTube video upload API. Videos could then be transferred seamlessly to YT without the end user having to setup a YT account.

1 Like

Would it be sufficient to have the video ‘unlisted’ rather than ‘private’? That way uploading would be the same but it could still be embedded without difficulty.

3 Likes

Yes, unlisted would be sufficient – that was actually what I was testing with. I could not figure out how to embed a private video.

3 Likes

Not bad, indeed!

That’s fairly special-purpose and would require a plugin. I’d still be inclined to limit videos to something like 5 minutes so that Discourse handle them.

This is what makes iOS devices so horrible for classrooms. Apple goes out of its way to make them for single users.

3 Likes

For the sake of user convenience - only using Discourse and not combining together different platforms - is it possible to change the settings so that Discourse can handle large files? An audio recording of a 30 minute presentation with an image-rich PPT that accompanies the audio can be larger than the default settings, but still well within the normal range of document sizes that people (at least myself) might want to share.

1 Like

See Changing Max Attachment Size

@sam: Perhaps someone should add upload_size: 10m in the params section of standalone.yml?

3 Likes

Hi Jay, since I don’t know what that does… would that make it much easier to upload large files to a Discourse site?

1 Like

Yes, the topic I linked to includes instructions for increasing the maximum upload size by adding a variable to app.yml, then you can increase the max upload size site setting.

3 Likes