remotion-dev/remotion · error · Error

CloudWatch retention period must be at least ${MIN_RETENTION

Error message

CloudWatch retention period must be at least ${MIN_RETENTION_PERIOD}, but is ${period}

What it means

Thrown by validateCloudWatchRetentionPeriod() (an Error) when the integer value is below the minimum of 1 day. CloudWatch does not support a sub-1-day retention policy, so values <= 0 are rejected after the type/finite/integer checks pass.

Source

Thrown at packages/lambda/src/shared/validate-retention-period.ts:36

		throw new TypeError(
			`CloudWatch retention period must be an integer, but is NaN`,
		);
	}

	if (!Number.isFinite(period)) {
		throw new TypeError(
			`CloudWatch retention period must be finite, but is ${period}`,
		);
	}

	if (period % 1 !== 0) {
		throw new TypeError(
			`CloudWatch retention period must be an integer, but is ${period}`,
		);
	}

	if (period < MIN_RETENTION_PERIOD) {
		throw new Error(
			`CloudWatch retention period must be at least ${MIN_RETENTION_PERIOD}, but is ${period}`,
		);
	}

	if (period > MAX_RETENTION_PERIOD) {
		throw new Error(
			`CloudWatch retention period must be at most ${MAX_RETENTION_PERIOD}, but is ${period}`,
		);
	}
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. To disable a custom retention policy, omit the field or pass null/undefined.
  2. Otherwise pass an integer >= 1 (and <= 3650).
  3. Validate the range in your config layer before calling deployFunction.

Example fix

// before
deployFunction({region, cloudWatchLogRetentionPeriodInDays: 0})
// after - to disable custom retention:
deployFunction({region, cloudWatchLogRetentionPeriodInDays: undefined})
Defensive patterns

Strategy: validation

Validate before calling

const MIN = 1
if (typeof period === 'number' && period < MIN) {
  throw new Error(`retention must be >= ${MIN}; pass undefined to skip`)
}

Type guard

const isRetentionInRange = (v: unknown): v is number =>
  typeof v === 'number' && Number.isInteger(v) && v >= 1 && v <= 3650

Prevention

When it happens

Trigger: Passing 0 or a negative integer as the retention period, often intending 'no retention' or 'default'.

Common situations: Confusing 0 with 'no policy' (you should pass undefined/null instead); accidental sign inversion; defaulting to 0 in config.

Related errors


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