storage icon indicating copy to clipboard operation
storage copied to clipboard

Uploaded .docx and .xlsx files are corrupted when using tus-server-node with Supabase S3 Storage

Open enriquesantos-dev opened this issue 1 year ago • 2 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the [Docs](https://docs.supabase.com), GitHub [Discussions](https://github.com/supabase/supabase/discussions), and [Discord](https://discord.supabase.com).

Describe the bug

When uploading .docx and .xlsx files using tus-server-node with @tus/s3-store (configured to use Supabase Storage via S3-compatible API), the files are saved corrupted. They cannot be opened by Microsoft Word, Excel, or Google Docs/Sheets after being uploaded.

Interestingly, .pdf files upload and open correctly using the exact same pipeline. Additionally, when I tested the same codebase with a native AWS S3 bucket instead of Supabase, all file types — including .docx and .xlsx — worked correctly. This suggests the issue may be related to Supabase's S3 compatibility.

To Reproduce

https://github.com/EnriqueSantos-dev/uppy-tus-server-supabase-s3-bug

Expected behavior

The uploaded .docx and .xlsx files should be saved and retrievable in a usable format, just like .pdf files. All supported MIME types should be stored without corruption.

Screenshots

No visual errors, but files are unreadable after upload. Opening them triggers a warning or error from Google Docs/Excel indicating the file is invalid or corrupted.

System information

OS: windows (wsl 2)

Browser: Chrome (latest)

Version of supabase-js: N/A (upload uses direct S3-compatible API)

Version of Node.js: 22.15.0

Server: Next.js v15.1.8 (App Router)

tus-server-node: @tus/server v2.2.0 and @tus/s3-store v2.0.0

Client: uppy.js v4.4.4 with @uppy/tus v4.2.2

Additional context

Here is a summary of my configuration:

  • @tus/s3-store is configured with forcePathStyle: true and uses Supabase credentials.

  • uppy.js is configured with the correct MIME types:

    allowedFileTypes: [
      "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
    ]
    
  • Files are uploaded successfully, but corrupted when retrieved — even directly from the Supabase dashboard.

  • Uploading to a native AWS S3 bucket using the exact same setup works perfectly for all file types.

enriquesantos-dev avatar May 24 '25 14:05 enriquesantos-dev

Hey @enriquesantos-dev, thanks for the detailed issue report and reproduction repo. Apologies for the delayed response.

I took your repro and extended it to verify the file by computing the SHA-256 checksums of the original files before uploading and comparing with the downloaded files from S3. I'm unable to reproduce the corruption issue, both .xlsx and .docx files upload successfully and files open correctly in Microsoft Word and Excel.

example test results:

=== CHECKSUM VERIFICATION ===
File: debug/file-3c4c0907f2689189945cf7a458263c15-test.xlsx
Original filename: test.xlsx
Original file checksum:  65bd895cddd2ba18c5ddf9371499838ab760106ad5e3129f8b7c2e6a0a97345e
Uploaded file checksum:  65bd895cddd2ba18c5ddf9371499838ab760106ad5e3129f8b7c2e6a0a97345e
Checksum match: ✓ YES

Actual file size: 4698 bytes
TUS reported size: 4698 bytes
Size match: ✓ YES
=============================

I tested this against production which is currently using the storage version 1.27.6

Are you still experiencing this issue? Given the time elapsed, I'm wondering if this may have been resolved in a past update in Supabase Storage or another dependency.

TylerHillery avatar Oct 23 '25 19:10 TylerHillery

Closing this issue for now, we can reopen if needed

TylerHillery avatar Nov 03 '25 14:11 TylerHillery