Skip to main content
You asked Replit Agent for an app where users paste a video link and the video gets saved. It works in the workspace preview with a test clip. Published, the save fails: the “video” is an HTML page, the site answers 403 or a bot check, or the request hangs until it times out. Files the app wrote to disk are gone after a restart.
  • A TikTok, YouTube, Instagram or X link is a web page, not a file, so fetch gets HTML back.
  • Many sites block requests from cloud servers, so a download that works from your laptop fails from the published app.
  • Autoscale deployments scale to zero when idle and restart regularly by design, so a file written to the deployment’s disk isn’t kept. Files belong in App Storage.
This page shows the free fix for links that already point at a file, where it stops, and a tested backend that gets any supported link into App Storage.

How App Storage works

From Replit’s App Storage and JavaScript SDK pages, checked November 27, 2026:
  • Buckets are always private. There is no public URL, so your app serves files to the users it has authorized.
  • Your app reaches its bucket through Replit’s SDK (@replit/object-storage for JavaScript, also one for Python), with no access keys to manage.
  • The app can upload, download, list and delete objects, but not change bucket settings.
  • There are no lifecycle rules. To clean up old files, run a Scheduled deployment that deletes them.
Because App Storage has no S3 access keys, Importly’s store: true delivery doesn’t apply here. Your backend copies the finished file into the bucket itself, server to server, as shown below. If the link points straight at a file (an .mp4 on a CDN or in another bucket), don’t read it into memory or write it to disk. Stream it into App Storage:
uploadFromStream resolves when the upload finishes and throws if it fails.

Where the free fix stops

Users rarely paste a file URL. They paste the page they watched the video on:
  • Getting the video out of a TikTok, YouTube or X page takes a downloader, and keeping one working means updating it every time a site changes.
  • The published app runs on datacenter IPs, which many sites block, so the downloader that works in the preview gets errors in production.
  • Long videos keep the request open the whole time, with the user waiting on it.
With Importly, your backend only sends the link. Importly downloads the video and calls your webhook when the file is ready, then your webhook copies it into App Storage. The tested Express server below has three routes:
  1. POST /api/videos starts the import and returns at once.
  2. POST /api/webhooks/importly copies the finished file into App Storage.
  3. GET /api/videos/:jobId/file streams the file back to your users from the private bucket.
Add your Importly API key in the Secrets tool as IMPORTLY_API_KEY, and your published app’s URL (for example https://your-app.replit.app) as APP_URL. Install the SDK with npm install @replit/object-storage, and create a bucket in the App Storage tool. new Client() uses the app’s default bucket.
server/index.ts
A few notes on the webhook route:
  • It 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 bucket. To reject forged requests earlier, also check the Importly-Signature header as shown in Verify signatures.
  • It answers 200 after the copy, and 500 if the copy fails. Importly waits 10 seconds for an answer and retries a delivery that fails or times out, with the same Importly-Webhook-Id. A long video can take longer than 10 seconds to copy, so a retry may arrive for a file that’s already saved; the exists check skips it.
  • The retries back off to hours apart, so also check records that have been pending for a few minutes with GET /import/status and run the same saveFile. The webhook URL must be public, so while you work in the workspace, poll the status endpoint instead.
mediaUrl stays valid for 7 days, so the copy can also run later from a status check. Set includeVideo: false for audio only. For a transcript instead of the file, see Use Importly from Lovable, Bolt or Replit; there’s no file to move. We ran this server against the live API with a TikTok link: the webhook copied the 1.5 MB video in under a second, a repeated delivery was skipped, and the file route returned the same bytes. App Storage itself was replaced by a local stand-in for the test, since it only runs on Replit.
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.