Skip to main content
Your app on Netlify, deployed from Bolt or written by hand, has a function that takes a video link, fetches the video and saves it. It works with a short clip. With a real video it fails in one of these ways:
  • Task timed out after … seconds in the function log, and a 502 in the browser.
  • The upload to your function, or the video your function sends back, is refused for being too large.
  • A long video saved to Netlify Blobs won’t play, because the function that serves it stops at 20 MB.
  • A 403, a bot check or an HTML page instead of a file, because the site blocks requests from cloud servers.
This page explains which limit you hit, the fixes that cost nothing, and where they stop.

The limits a video runs into

From Netlify’s Configuration for functions page, checked November 27, 2026: A 10-minute 720p video is about 77 MB: over the payload limits many times, and often more than a minute to download and upload again.

Which one you hit

If the link points straight at a file (an .mp4 on a CDN or in another bucket):
  • Do the copy in a background function. The caller gets a 202 at once and the function has 15 minutes instead of 60 seconds.
  • Keep videos in storage that gives you a URL, such as Supabase Storage, S3 or R2, and send the browser a signed URL to play from. Don’t return the file from a function.
  • For files users pick on their own device, let the browser upload straight to that storage with a signed upload URL, so the file never passes through a function.

Where the free fixes stop

These only work 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 fetch returns HTML. Getting the video out takes a downloader, and a function has 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 Netlify’s servers.
  • Even in a background function, a long or slow download has to finish within 15 minutes, and a failure is retried only twice.

Let the file skip the function

With Importly, your function only sends the link. Importly downloads the video and puts it in your own bucket (Supabase Storage, S3, R2 and other S3-compatible storage), then calls your webhook. The function replies in about a second, and the file never passes through it. Connect the bucket once on the S3 storage page; for Supabase, Save videos to Supabase Storage walks through it.
netlify/functions/videos.mts
The webhook goes to a background function. Netlify answers Importly’s request with a 202 straight away, so the delivery never waits on your database, and your code has 15 minutes. The function takes only the jobId from the request and reads the result from the API with your key, so a forged request can’t put a file into your app. To reject forged requests earlier, also check the Importly-Signature header as shown in Verify signatures.
netlify/functions/importly-webhook.mts
Set IMPORTLY_API_KEY and APP_URL (your site’s URL) in Site configuration → Environment variables. Each job gets one delivery, so also check records that have been pending for a few minutes with GET /import/status. The webhook URL must be public https://, so in local development poll the status endpoint instead. See Webhooks. s3Storage.key is where the file is in your bucket. Buckets are private by default, so play files through signed URLs. storageFilename gives each file a name you control, which keeps keys free of the emoji and hashtags in many video titles. Set includeVideo: false for audio only. For a transcript instead of the file, there’s no file to move: see Transcripts.
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.