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
- Round to the nearest integer with Math.round() (or truncate with Math.floor/ceil) before passing.
- Validate Number.isInteger() and surface a config error earlier.
- 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
- Round computed retention with Math.round() before passing.
- Use Number.isInteger() as a pre-flight check.
- Keep retention as a literal integer in config where possible.
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
- CloudWatch retention period should be a number, got: ${JSON.
- CloudWatch retention period must be an integer, but is NaN
- CloudWatch retention period must be finite, but is ${period}
- A custom role ARN must either be "undefined" or a string, bu
- CloudWatch retention period must be at least ${MIN_RETENTION
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/46c7a9005e4ba04e.
Report an issue: GitHub.