Video size limit error in CHT

While adding videos in my form in CHT, I noticed that medic-conf fails to compile when the total video size in the form media folder is 16MB or above. Is there max size limit for uploading videos?

CHT Version: 3.13

Error:

ERROR FetchError: invalid json response body at https://medic.local:4430/medic/form%3Avideos_test reason: Unexpected token < in JSON at position 0
at /home/user/nodeV12/lib/node_modules/cht-conf/node_modules/pouchdb-fetch/node_modules/node-fetch/lib/index.js:272:32
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)

I believe we’ve come across crashes when forms have large image attachments (6MB in this particular case). This however never happened when uploading the resources but when the phone was downloading them to and saving them in PouchDB.

I’m not aware of any hard size limits.

Are you able to split your video into multiple parts? Has it been optimised to match your phone’s resolution (it would also help with reducing the file size)

1 Like

Hi @iesmail

We have a 32mb upload limit in API: cht-core/api/src/routing.js at master · medic/cht-core · GitHub
However I’m not sure that’s what is causing your problem.

Can you please share at which point does cht-conf fail? What command are you running?
Could you also check your API logs and see if there’s anything suspicious there?
I’m partially suspecting a request timeout that returns HTML instead of json.

Hi @diana

medic-conf fails at a point when it’s uploading the form.

I am running


medic-conf --url=https://medic:password@localhost -- --debug

Also I checked the logs but could not find anything suspicious.

Hello @iesmail,

I have been able to add videos to a form that are 22MB and 18MB in size. When I tried to upload both at the same time I got the error below which leads me to suspect there might be an issue with your form. Are you able to share the form’s xml file?

ERROR {
  "code": 413,
  "error": "Payload Too Large",
  "status": 413,
  "name": "Payload Too Large",
  "docId": "form:video_test"
}
1 Like

Hi @njuguma,

Here’s the link to the form: videos_test - Google Sheets

Hi @iesmail,

I am still unable to replicate your issue. I still see the error I posted above when the video files are too large. I am using cht-conf version 3.9.2 locally. Which version are you running? You find out the version by running cht --version.

In the mean time maybe you can try adding the videos to the form using couchdb.