Media-factory

Hosted TikTok Publishing Hardening

AMC OS can publish TikTok videos from Codespaces with direct file upload, but hosted environments such as Render have tighter memory limits. In production, TikTok publishing should prefer URL-based media transfer through Cloudflare R2 public media.

Set these in Render:

AMC_TIKTOK_TRANSFER_MODE=auto
AMC_TIKTOK_ALLOW_HOSTED_FILE_UPLOAD=false
AMC_TIKTOK_PULL_FROM_URL_VERIFIED=false

auto means AMC OS will use Cloudflare R2 public media when available. In production, file upload is blocked unless AMC_TIKTOK_ALLOW_HOSTED_FILE_UPLOAD=true is explicitly set.

Why Pull From URL

The dashboard process should not hold large video uploads in memory while also serving the web UI. Instead, AMC OS uploads or reuses the rendered video in R2 and sends TikTok the public HTTPS URL.

The flow is:

selected dashboard video
→ find existing public_media record for the package
→ otherwise upload final.mp4 to R2
→ initialize TikTok post with PULL_FROM_URL
→ TikTok downloads the media from R2
→ AMC OS records the publish result

TikTok URL verification

TikTok Pull From URL requires the public video URL domain or URL prefix to be verified in TikTok URL properties. After verifying your R2 public media domain or URL prefix in the TikTok developer portal, set:

AMC_TIKTOK_PULL_FROM_URL_VERIFIED=true

This flag is a readiness indicator for AMC OS and app review. It does not perform TikTok-side verification by itself.

Transfer modes

AMC_TIKTOK_TRANSFER_MODE=auto

Uses R2 Pull From URL when possible. In production, this is the safest default.

AMC_TIKTOK_TRANSFER_MODE=pull_from_url

Requires a public R2 URL. Publishing fails if public media cannot be resolved.

AMC_TIKTOK_TRANSFER_MODE=file_upload

Uses the older local binary upload path. This should only be used for local development or with AMC_TIKTOK_ALLOW_HOSTED_FILE_UPLOAD=true.

Error handling

TikTok/provider HTML or proxy error pages are truncated before being shown in the dashboard. Full details should be inspected from provider logs or saved result JSON when needed.