- A 546 with that body, and
Memory limit exceededorCPU Time exceededin the function’s Logs tab. - A 504 Gateway Timeout when the function hasn’t responded after 150 seconds.
- The function stops part-way through a long download or upload, because it reached its wall-clock limit.
The limits a video runs into
From Supabase’s Edge Functions limits page, checked November 27, 2026:
Supabase Storage adds its own cap: on the Free plan a single file can be at most 50 MB, and paid plans can raise it to 500 GB (file limits). A 10-minute 720p video is about 77 MB.
Why a video triggers a 546
The usual generated code reads the whole file into memory before uploading it:Free fix: stream direct file links into Storage
If the link points straight at a file (an.mp4 on a CDN or in another bucket), pass the response body through instead of buffering it. The file then flows from the source to Storage in pieces:
supabase/functions/save-file/index.ts
- To answer first and keep working,
EdgeRuntime.waitUntil(promise)lets the function return a response straight away and finish the upload as a background task, so the caller doesn’t sit through the 150-second idle timeout. The wall-clock limit still applies to the background task. - For big files, Supabase recommends its TUS resumable upload endpoint for files over 6 MB, which also lets a failed upload continue where it stopped.
Where the free fixes stop
Streaming only works when you already have a URL that returns the file. That’s rarely what users paste:- A TikTok, YouTube, Instagram or X link is a web page, not a file, so
fetchreturns HTML. Getting the video out takes a downloader, and an Edge Function can’t run one: there’s no binary to run and no way to merge separate audio and video streams. - The same code often fails once deployed. Many sites block requests from cloud servers, so a download that works from your laptop gets an error or a bot check from Supabase’s servers. See Works locally, fails deployed.
- Long videos run past the wall clock. Even a streamed transfer has to finish within 150 seconds on Free or 400 seconds on paid plans.
Let the file skip the function
With Importly, the Edge Function only sends the link. Importly downloads the video and puts the file in your own Supabase Storage bucket, then calls a webhook when it’s there. The function replies in about a second, so none of the limits above apply, and the file never passes through its memory.videos table, the signed webhook and playing files with signed URLs) is in Save videos to Supabase Storage. The Free plan’s 50 MB file cap still applies to what lands in your bucket, so use a lower videoQuality or audio only (includeVideo: false) for long videos on Free.
For a transcript instead of the file, see Save transcripts to Supabase from an Edge Function.
A 10-minute 720p video costs about $0.15 to import, and
maxCostDollars stops a long one before it’s charged. Try it free, no card required. See Pricing & credits.