remotion-dev/remotion · error · TypeError

CloudWatch retention period must be an integer, but is ${per

Error message

CloudWatch retention period must be an integer, but is ${period}

What it means

Thrown by validateCloudWatchRetentionPeriod() (a TypeError) when the value is a finite number but not an integer (period % 1 !== 0). CloudWatch retention is measured in whole days.

Source

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

				period,
			)}`,
		);
	}

	if (Number.isNaN(period)) {
		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. Round to the nearest integer with Math.round() (or truncate with Math.floor/ceil) before passing.
  2. Validate Number.isInteger() and surface a config error earlier.
  3. Ensure config sources provide whole-day values.

Example fix

// before
deployFunction({region, cloudWatchLogRetentionPeriodInDays: avg /* 7.5 */})
// after
deployFunction({region, cloudWatchLogRetentionPeriodInDays: Math.round(avg)})
Defensive patterns

Strategy: validation

Validate before calling

if (typeof period === 'number' && Number.isFinite(period) && !Number.isInteger(period)) {
  throw new TypeError('retention must be an integer number of days')
}

Type guard

const isIntegerDays = (v: unknown): v is number => Number.isInteger(v)

Prevention

When it happens

Trigger: Passing a fractional number such as 7.5, 0.1, or a computed average that produced a non-integer.

Common situations: Averaging retention values; arithmetic that yields a fraction; floating-point drift from prior calculations.

Related errors


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