- A 504 when the download and upload together run past the function’s maximum duration.
- A 413 when the browser uploads the video to your route, or a 500 when the route sends the video back in its response.
- A failed build after you add a downloader package that ships its own binaries.
- A 403, a bot check or an HTML page instead of a file, because the site blocks requests from cloud servers.
The limits a video runs into
From Vercel’s Functions limits page (Node.js runtime with Fluid compute), checked November 27, 2026:
A 10-minute 720p video is about 77 MB, so it is over the body limit many times, and buffering a long video can run into memory before it reaches the duration limit.
Which one you hit
Free fixes for direct file links
If the link points straight at a file (an.mp4 on a CDN or in another bucket), don’t buffer it and don’t send it through your response. Stream it from the source into Vercel Blob:
app/api/save-file/route.ts
- When users pick a file on their own device, have the browser upload it straight to Blob with a client upload, so the file never passes through your function and the 4.5 MB limit doesn’t apply.
- On Pro, raise
maxDurationfor the route (up to 800 s) if a long transfer is the only problem. - For playback, send the browser the Blob URL instead of returning the file from your route.
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 adding one to a Vercel Function brings binaries that push against the 250 MB bundle limit and need upkeep every time a site changes. - 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 Vercel’s servers.
- Long videos still have to finish inside the maximum duration, and the user waits on the request the whole time.
Let the file skip the function
With Importly, your route only sends the link. Importly downloads the video and calls your webhook when the file is ready, so the route replies in about a second and none of the limits above apply to the download.app/api/videos/route.ts
POST to your webhook. Answer it straight away and copy the file into Blob afterwards with after, since the webhook doesn’t wait for slow work. The handler 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.
app/api/webhooks/importly/route.ts
GET /import/status. The webhook URL must be public https://, so in local development poll the status endpoint instead. See Webhooks.
mediaUrl stays valid for 7 days. To skip the copy step, set store: true and Importly puts the file in your own S3-compatible bucket (S3, R2, Supabase Storage and others), as in Save files to your bucket. Set includeVideo: false for audio only.
For a transcript instead of the file, the Next.js guide does it in one route with wait, with no file to move at all.
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.