Skip to content

Conversation

@Adityakk9031
Copy link

Issue

TUS resumable uploads through Supabase Studio return HTTP 500/409 errors when using RustFS as the S3-compatible backend, despite files uploading successfully.

Error messages:

  • HTTP 500: "One or more of the specified parts could not be found"
  • HTTP 409: "The resource already exists"

Root cause: RustFS implementation of CompleteMultipartUpload rejects the parts list or returns an error response even though the file is successfully persisted to storage. This prevents the onUploadFinish hook from executing, leaving the file metadata missing from the Postgres database.

Solution

Created a CustomS3Store that extends @tus/s3-store with graceful error handling:

  • Wraps the finish() method to catch CompleteMultipartUpload errors
  • On error, performs a HeadObject request to verify if the file actually exists
  • If the object exists, treats the upload as successful and returns metadata
  • If verification fails, re-throws the original error

This allows uploads to complete successfully even when RustFS returns confusing error responses.

Changes

-Added: src/http/routes/tus/custom-s3-store.ts - Custom S3Store with error recovery

  • Modified:src/http/routes/tus/index.ts - Replaced S3Store with CustomS3Store

Related Issue

Fixes #41578

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Supabase Studio TUS uploads return 500/409 errors with RustFS S3 backend, but files upload successfully

1 participant