Implements TUS resumable upload protocol for files >6MB with advisory lock conflict handling.
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Risky
Do not use without reviewing
Implements the TUS resumable upload protocol for files exceeding 6MB with Postgres Advisory Lock conflict handling and tenant-scoped paths.
This tile configures the TUS 1.0.0 resumable upload flow against the Supabase Storage API. Files over 6MB MUST use this protocol instead of the standard single-request upload. Uploads are chunked at 6MB boundaries, and each chunk is acknowledged by the server with an updated offset. On network interruption, the client resumes from the last confirmed offset. Concurrent uploads to the same path trigger a Postgres Advisory Lock, returning a 409 Conflict that MUST be handled with exponential backoff.
POST ${SUPABASE_URL}/storage/v1/upload/resumable
PATCH <upload-url-from-location-header>
HEAD <upload-url-from-location-header>| Header | Value |
|---|---|
| Authorization | Bearer <access_token> |
| Tus-Resumable | 1.0.0 |
| Upload-Length | File size in bytes |
| Upload-Metadata | base64-encoded bucket, object, contentType |
| x-upsert | false (default) |
| Header | Value |
|---|---|
| Content-Type | application/offset+octet-stream |
| Upload-Offset | Current byte offset |
| Tus-Resumable | 1.0.0 |
| Status | Cause | Action |
|---|---|---|
| 409 | Advisory Lock collision | Retry with backoff: 1s, 2s, 4s |
<tenant_id>/<resource_type>/<filename>storage-path-validation is deployed.