remotion-dev/remotion · error · TypeError

Privacy must be a string

Error message

Privacy must be a string

What it means

Thrown by validatePrivacy() (an asserts-narrowing function) when the privacy argument is not a string. This is the type guard before the value allow-list check. Privacy controls the ACL applied to rendered outputs in GCS.

Source

Thrown at packages/cloudrun/src/shared/validate-privacy.ts:5

import type {Privacy} from './constants';

export function validatePrivacy(privacy: unknown): asserts privacy is Privacy {
	if (typeof privacy !== 'string') {
		throw new TypeError('Privacy must be a string');
	}

	if (privacy !== 'private' && privacy !== 'public' && privacy !== 'no-acl') {
		throw new TypeError(
			'Privacy must be either "private" or "public" or "no-acl"',
		);
	}
}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass one of the allowed privacy strings: 'public', 'private', or 'no-acl'.
  2. Default privacy when it is unset: const privacy = config.privacy ?? 'public'.
  3. Validate config at startup before invoking the render API.

Example fix

// before
const { PRIVACY } = process.env; // undefined
await renderMediaOnCloudRun({ privacy: PRIVACY, ... });
// after
const privacy = process.env.PRIVACY ?? 'public';
await renderMediaOnCloudRun({ privacy, ... });
Defensive patterns

Strategy: type-guard

Validate before calling

import { validatePrivacy } from '@remotion/cloudrun/shared';
validatePrivacy(privacy);

Type guard

function isPrivacyString(v: unknown): v is string {
  return typeof v === 'string';
}

Try / catch

const privacy = typeof inputPrivacy === 'string' ? inputPrivacy : 'public';

Prevention

When it happens

Trigger: Passing a non-string privacy value (undefined, null, number, object) to renderMediaOnCloudRun()/renderStillOnCloudRun() or bucket upload APIs.

Common situations: Reading privacy from env/config where it is unset; passing the wrong field from a typed object; defaulting to undefined instead of a known privacy string.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/a9f44644417eed78. Report an issue: GitHub.