Get 400 Bad Request when uploading video

I use tus-js-client and upload a 305 megabytes (55 seconds) video with tokenized url (Direct creator uploads). It works fine. Then, I try to upload a 5.9 gigabytes (189 minutes) .mkv video. It works fine in the beginning too. However, when the progress reach around 37%, it suddenly brings out 400 Bad Request error, and I had tried multiple times but it still shows the same error.

The 400 response body below

  "result": null,
  "success": false,
  "errors": [
      "code": 10005,
      "message": "Bad Request"
  "messages": null

The requests in Network tab

Here is my code below

const upload = new tus.Upload(file, {
  endpoint: url,
  chunkSize: 50 * 1024 * 1024,
  metadata: {
    filename: filename,
    filetype: file.type,
  uploadSize: file.size,
  onError: (err) => {
    status = 'failed'
  onProgress: (bytesUploaded, bytesTotal) => {
    percentage = Math.round((bytesUploaded * 100) / bytesTotal)
  onSuccess: () => {
    status = 'completed'

It seems like reach the maximum file size limit or timeout, and I check my account I still have 8000 minutes of the video storage. So I can’t figure out what’s going on. Did I miss something?

What is the chunkSize that you are using? I ran a test with my demo codepen:

If I leave the chunkSize field blank in my demo, I can reproduce your issue with a 6gb file.

If I change the chunkSize to 157286400, the video uploads successfully.

Are you able to replicate this issue each time you try to upload?

Thanks for the reply!!!

I have try to upload the 5.9gb video with your codepen demo, but it shows the same error

Yes, I had try this for multiple times, always show the same 400 Bad Request error when the progress percentage reach 37%

The problem solved… Sorry, my bad, I give a wrong Upload-Length when I requesting the tokenized url…

1 Like