Insights / October 24, 2026

Large video uploads in a Lovable or Supabase app: what breaks

Large video uploads fail in AI-built apps for four reasons: a single request has size and time limits, sign-in sessions expire partway through a long batch, phones pause apps that aren’t on screen, and an upload that can’t resume starts again from zero after any hiccup. Chunked, resumable uploads fix the first and last. The rest only show up with real users, real files and real networks.

Here’s how big uploads break, and how we fixed each failure in a real Lovable app.

Why large file uploads fail

Request limits. Supabase recommends its standard upload for files up to 6 MB, with a hard ceiling of 5 GB. On top of that, the global file size limit is 50 MB on the Free plan and up to 500 GB on paid plans, so a Free project rejects many phone videos outright. Routing files through a server function or worker adds its own limits: a Cloudflare Worker gets 128 MB of memory, so a worker that holds a whole video in memory before passing it on fails on any long phone video.

No resume. A 2 GB file sent in one request fails completely if the connection drops at 99%. Splitting it into separately uploaded parts means a failure costs one part. Supabase does this with resumable (TUS) uploads in 6 MB chunks. S3-compatible storage does it with multipart uploads and presigned URLs, which are short-lived links that let the browser or phone send each part straight to storage.

Sessions expire. A Supabase access token lasts one hour by default. A batch of several hundred videos takes longer than that.

Phones don’t wait. iOS suspends an app soon after the user switches away. Only transfers handed to the system’s background upload service keep going.

The app

A media delivery app: creators upload large batches of high-resolution phone video, from the website and an iOS app, and their clients view and download them. Batches run to hundreds of files, and single videos can be 4 GB or more.

On paper the pipeline already had the right shape: multipart uploads through presigned URLs to S3-compatible storage (not Supabase Storage), a Cloudflare Worker as the upload API, and a native iOS uploader with an on-device queue. It worked in testing. At scale, files failed, stalled or went missing, and almost none of it left a readable trace.

What broke, and how we fixed it

Browser uploads stuck at 0%

The storage bucket had no CORS rule, the setting that tells storage which websites may upload to it. The browser blocked every direct upload, so every file fell back to going through the Worker, which ran out of memory and hung. Bugs in the upload code turned that into a permanent freeze: a restart loop with no limit and no error left over 1,300 uploads dead without a trace.

Fix: add the CORS rule, refuse files over 50 MB on the Worker fallback path so it can’t run out of memory, and cap automatic restarts at three, ending with a clear error instead of an endless “Retrying…”.

Sign-in expiring halfway through a batch

On the website, a batch of nearly 900 files ended with 217 failures. The sign-in token had expired mid-batch, and the upload code treated “not authorized” as a permanent error, so each file failed for good.

Fix: treat an expired token as recoverable, refresh it once for all waiting files, and refresh early when less than five minutes remain.

On iOS it was worse. When the token expired, the native uploader paused and sent a signal nothing was listening for, so uploads froze until the user reopened the app. Each file also kept the token from when it was queued, stale hours later. Now every refreshed token reaches the native uploader, including on return to the foreground, and it always uses the freshest one. After 30 minutes without a valid token, files fail as retryable instead of waiting forever.

Uploads that silently stopped

Over two weeks, 946 upload sessions were abandoned without a single chunk sent. The recovery steps existed in the native code, but nothing ever triggered them.

Fix: a stall watchdog. If there’s a backlog and no bytes have moved for 45 seconds (120 seconds for big batches), it escalates through recovery steps with growing pauses between attempts. The native uploader also runs a self-healing check every 30 seconds, and after about 50 minutes of zero progress a file becomes a retryable failure rather than a frozen row.

Files still downloading from iCloud

When originals live in iCloud, the phone has to download each video before uploading it. That caused two problems:

  • Files deleted mid-upload. The app deleted its temporary copy of a file while that file was still uploading, and Retry pointed at the deleted copy. A 267-file batch lost about 7% this way. Copies are now deleted only after the server confirms the upload, and Retry fetches the video from the photo library again.
  • Slow downloads blocking everything. Slow iCloud downloads tied up the export slots while the rest of the batch waited, and the watchdog declared the waiting files dead: 28 of 50 videos in one batch showed as failed. Now files already on the phone go first, and iCloud files download one at a time, marked as waiting rather than stuck.

Edited iPhone photos

The app checked each exported file against the size the photo picker reported. For a photo with a Photographic Style or a Photos edit, that’s the original’s size, but the export delivers the edited version, so every edited photo failed all five retries. The check now uses the exported file’s size.

Phones short on storage or memory

Uploading a 4 GB iCloud video needs about twice its size in free space: one copy downloading from iCloud, one staged for upload. When the disk filled, a file write threw an error the app couldn’t catch, so it crashed, relaunched, retried and crashed again.

Fix: catchable writes that fail the file instead of the app, and a size check before export that tells the creator how much space to free up, such as “This video needs about 8 GB free” for a 4 GB iCloud video, instead of writing gigabytes and failing. A full storage plan used to make the app retry every 1.4 seconds, forever. Now it shows “Your storage plan is full” with the numbers. For memory, chunks stream from disk rather than through memory, fewer run at once when the phone is low on memory, and files over 1 GB use smaller parts.

The step that linked a finished video to its gallery ignored errors and reported success anyway. When the database had a brief hiccup, the video uploaded but never appeared, and no retry or cleanup job could notice. Now the link is retried, verified, and reported as retryable if it fails, and a background job relinks anything that slipped through.

Three more gaps had the same effect:

  • Duplicate detection. Picking 75 or more items switched the app’s photo picker to a mode with less file information. Duplicates were then matched on capture time to the second, so 400 picked videos became about 100. Matching now requires exact keys.
  • Retries. A retried upload created a second gallery entry. It now reuses the original.
  • False completions. The server marked an upload as already complete without checking the file existed. It now checks storage first, and galleries sort by capture time rather than by which file finished first.

Seeing what actually happened

Every fix above started from evidence. The iOS app keeps a detailed log per upload session, listed under Upload Logs in settings, which users can share straight from the phone. Server-side telemetry records each failure and stall with a plain-English reason, the file, the device model and the OS version. And 54 automated tests guard the rules behind past incidents, so a regression fails the build.

The result

Multi-gigabyte phone videos now upload in the foreground and the background, including a 3.15 GB video that used to crash the app, which went through in 188 parts with memory flat. When a phone hits a real limit, like a full disk or a full plan, the creator sees what to do, and support can read exactly what happened.

How to test large uploads in your own app

  1. Use real files. 4K phone videos of 2–5 GB, not a 10 MB sample, plus edited photos.
  2. Use real batch sizes. A few hundred files, enough to outlast a one-hour sign-in token.
  3. Break the network. Airplane mode mid-batch, Wi-Fi to cellular, weak signal.
  4. Leave the app. Lock the phone and switch apps: uploads should keep going. Then force-quit and reopen. iOS cancels background transfers on a force-quit, so the app should restart unfinished uploads without duplicates.
  5. Use iCloud originals. Turn on Optimize iPhone Storage so videos have to download from iCloud first.
  6. Fill the phone. Under 2 GB free, and an account at its storage limit. Expect a clear message, not a crash or frozen progress bar.
  7. Test old devices. An older iPhone with little memory finds problems a new one hides.
  8. Count what arrived. Compare files picked with files in the gallery, in order. “Upload complete” isn’t proof.
  9. Check your logs. For every failure, could you tell why from the logs alone? If not, fix that first.

For other limits that bite at scale, see Supabase Edge Function limits and what breaks in Lovable apps.

If your app’s uploads work in testing but fail for real users, our Lovable rescue starts by finding out exactly where they break.

LET’S TALK.

Book a free 30-minute call with Virgil

Pick a time that suits you. You’ll get a straight answer on what you need, what it should cost and the fastest path to launch.

Loading available times…

Open the calendar in a new tab

Send us your project

Virgil replies personally within one business day.

Book a free strategy call