tus / tusd

Reference server implementation in Go of tus: the open protocol for resumable file uploads
https://tus.github.io/tusd
MIT License
2.92k stars 465 forks source link

validating video files using blocking hooks #1133

Closed mohamadrezza closed 1 month ago

mohamadrezza commented 1 month ago

Describe the bug I want to validate my uploading video files using ffprobe and send appropriate response to user (for validation). The documentation suggests using blocking hooks for this purpose(pre-create,pre-finish). However, when working with the pre-finish hook, I don't have access to the video file to perform validation. and i get this error : "ERR_LOCK_TIMEOUT: failed to acquire lock before timeout" but when i work with post-finish hook, everything works fine, but i can't send response to client in this step. i implemented my hook as a webhook

Expected behavior i want to access video files for validating with ffprobe in pre-finish hook

Setup details Please provide following details, if applicable to your situation:

Acconut commented 1 month ago

Are you trying to send a GET request to the upload resource in the pre-finish hook? That won't work because the upload is still locking until pre-finish (and other request handling) finishes. You would have to fetch the resource from S3 directly.

mohamadrezza commented 1 month ago

Are you trying to send a GET request to the upload resource in the pre-finish hook? That won't work because the upload is still locking until pre-finish (and other request handling) finishes. You would have to fetch the resource from S3 directly.

but i can access file when the data storage is local disk. it's weird for me that we don't have access to the file in pre-finish on s3, unlike the default back-and-storage?

Acconut commented 1 month ago

What do you mean exactly when you say that you are "accessing the files"? Can you describe in more details what you are doing exactly? Or could you even provide an example to produce this issue? I am still not entirely sure what you are attempting here.

mohamadrezza commented 1 month ago

What do you mean exactly when you say that you are "accessing the files"? Can you describe in more details what you are doing exactly? Or could you even provide an example to produce this issue? I am still not entirely sure what you are attempting here.

as i mentioned before,i mean i can't read file with ffprobe (i get ERR_LOCK_TIMEOUT error)... when the data storage is local disk the i can read the file with ffprobe on pre-finish hook, and everything works fine but when the storage is s3, it returns ERR_LOCK_TIMEOUT error