remotion-dev/remotion · error · TypeError

Expected deleteAfter value to be one of ${Object.keys(expiry

Error message

Expected deleteAfter value to be one of ${Object.keys(expiryDays).join(', ')}, got ${lifeCycleValue}

What it means

Thrown by validateDeleteAfter() in @remotion/lambda-client when deleteAfter is a string but not one of the allowed lifecycle keys. Allowed keys (from the expiryDays map) are exactly: '1-day', '3-days', '7-days', '30-days'. The value is used as an S3 lifecycle expiration identifier, so it must match a known key.

Source

Thrown at packages/lambda-client/src/aws-provider.ts:92

const validateDeleteAfter = (lifeCycleValue: unknown) => {
	if (lifeCycleValue === null) {
		return;
	}

	if (lifeCycleValue === undefined) {
		return;
	}

	if (typeof lifeCycleValue !== 'string') {
		throw new TypeError(
			`Expected life cycle value to be a string, got ${JSON.stringify(
				lifeCycleValue,
			)}`,
		);
	}

	if (!(lifeCycleValue in expiryDays)) {
		throw new TypeError(
			`Expected deleteAfter value to be one of ${Object.keys(expiryDays).join(
				', ',
			)}, got ${lifeCycleValue}`,
		);
	}
};

export const awsImplementation: ProviderSpecifics<AwsProvider> = {
	getChromiumPath() {
		return '/opt/bin/chromium';
	},
	getBuckets: getRemotionBuckets,
	createBucket,
	applyLifeCycle: applyLifeCyleOperation,
	listObjects: lambdaLsImplementation,
	deleteFile: lambdaDeleteFileImplementation,
	bucketExists: bucketExistsInRegionImplementation,
	randomHash: randomHashImplementation,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Use exactly one of: '1-day', '3-days', '7-days', '30-days'.
  2. If you need a different retention, pick the nearest supported bucket or manage the S3 lifecycle rule directly.
  3. Trim and validate against the list before passing.

Example fix

// before
await cleanUpS3Files({ deleteAfter: '7' });

// after
await cleanUpS3Files({ deleteAfter: '7-days' });
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = ['1-day', '3-days', '7-days', '30-days'] as const;
const deleteAfter = (ALLOWED as readonly string[]).includes(raw) ? (raw as any) : undefined;

Type guard

const isDeleteAfterKey = (v: unknown): v is '1-day' | '3-days' | '7-days' | '30-days' =>
  typeof v === 'string' && ['1-day', '3-days', '7-days', '30-days'].includes(v);

Prevention

When it happens

Trigger: Passing deleteAfter: '7' (bare number-as-string), '7days' (no dash), '7-days ' (trailing space), '14-days', '90-days', or any other string not in the allowed set.

Common situations: Dropping the dash, pluralizing wrong ('1-days'), using a duration the map doesn't support (e.g. 14 or 90 days), or copy-pasting a value from another tool's format.

Related errors


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