remotion-dev/remotion · error · Error

CloudWatch retention period must be at most ${MAX_RETENTION_

Error message

CloudWatch retention period must be at most ${MAX_RETENTION_PERIOD}, but is ${period}

What it means

Thrown by validateCloudWatchRetentionPeriod() (an Error) when the integer value exceeds the maximum of 3650 days (10 * 365). Remotion caps retention at 10 years, below CloudWatch's own hard limit, for sane log management.

Source

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

		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. Pass an integer between 1 and 3650 inclusive.
  2. Use 3650 if you want the longest supported retention.
  3. Validate the upper bound in config before calling deployFunction.

Example fix

// before
deployFunction({region, cloudWatchLogRetentionPeriodInDays: 1000000})
// after
deployFunction({region, cloudWatchLogRetentionPeriodInDays: 3650})
Defensive patterns

Strategy: validation

Validate before calling

const MAX = 3650
if (typeof period === 'number' && period > MAX) {
  throw new Error(`retention must be <= ${MAX}`)
}

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 a large integer such as 1000000; defaulting to a 'very large' sentinel intending 'keep forever'.

Common situations: Misunderstanding the cap; passing the raw CloudWatch maximum; computing retention from an over-large formula.

Related errors


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