Open Kyst90 opened 1 week ago
You seem to be misunderstand the post-terminate hook. It's emitted if an upload gets finally deleted using a DELETE request. It is not emitted if an upload is interrupted. Tusd does not have an event for upload interruption. Please see https://github.com/tus/tusd/issues/1182 for a discussion on this topic.
Hello,
I am experiencing an issue with tusd on my server where the post-terminate hook is not being invoked when a file upload is canceled or interrupted. As a result, necessary cleanup or other actions associated with terminating the upload are not executed.
Current Behavior: When an upload is interrupted, the post-terminate hook does not appear in the tusd logs. Instead, an ERR_UNEXPECTED_EOF error is logged, and only the post-receive hook is triggered.
Expected Behavior: Upon canceling or interrupting an upload, the post-terminate hook should be called automatically to perform necessary actions such as cleaning up partial files.
Steps to Reproduce: Initiate a file upload using tusd. Interrupt the upload (e.g., close the browser or disconnect the internet). Check the tusd logs to verify that the post-terminate hook is not invoked and instead an ERR_UNEXPECTED_EOF error is logged. Attempts to Resolve: Checked Hook Configuration:
Verified that the hooks directory is correctly specified. Ensured that all hook scripts (post-terminate.sh, etc.) have execute permissions. Manual Testing of Hooks:
Ran the post-terminate.sh script manually to confirm it executes without errors. Updated tusd:
Confirmed that the latest stable version of tusd is being used. Log Analysis:
Observed that while post-receive is called appropriately, post-terminate is not triggered upon upload interruption. Additional Information: tusd Version: [v2.5.0] Operating System: [Ubuntu 24.04] Upload Method: Using PATCH requests for uploading chunks. Client Library: [tus-js-client]
Questions: Why is the post-terminate hook not being invoked when an upload is canceled or interrupted? Is there a way to handle ERR_UNEXPECTED_EOF errors through existing hooks or other mechanisms provided by tusd? Can tusd be configured to automatically trigger a specific hook upon encountering such errors?
Conclusion: I would greatly appreciate any assistance or recommendations to resolve this issue. It might be a bug in tusd or perhaps a missing configuration on my part. Thank you in advance for your help!