-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Thanks again for the great work here @hossein-zare
I'm trying to use the lib to upload to MUX as direct upload but somehow I'm getting 400 bad request :
https://docs.mux.com/guides/video/upload-files-directly#if-you-dont-want-to-use-upchunk
I've added "content-length" and "content-range" headers as Mux is asking, but the catch block only sends back a text error saying "Error: Request failed with status code 400". Therefore I'm having trouble debugging because I don't know what I'm doing wrong not having the whole error object.
Here is my code :
axios.put(muxUploadUrl, body, {
headers: {
"Content-Type": "multipart/form-data",
"Accept": 'application/json',
"Content-Length": file.headers["x-chunk-size"],
"Content-Range": `bytes ${file.number - 1}-${file.headers["x-chunk-size"]}/${file.headers["x-file-size"]}`,
// Customize the headers
"x-chunk-number": file.headers["x-chunk-number"],
"x-chunk-total-number": file.headers["x-chunk-total-number"],
"x-chunk-size": file.headers["x-chunk-size"],
"x-file-name": file.headers["x-file-name"],
"x-file-size": file.headers["x-file-size"],
"x-file-identity": file.headers["x-file-identity"]
}
})
.then(response => {
console.log('response : ', response)
})
.catch(error => {
console.log( 'Upload error : ', error)
...
Am I mistaking the headers configuration ? Should I split the file chunks in other values than the ones from the readme ?
Have you ever tried the lib with Mux ?
Thank you so much for your help 🙌🏼
Metadata
Metadata
Assignees
Labels
No labels