{"record":{"id":"46c7a9005e4ba04e","repo":"remotion-dev/remotion","slug":"cloudwatch-retention-period-must-be-an-integer-bu-46c7a9","errorCode":null,"errorMessage":"CloudWatch retention period must be an integer, but is ${period}","messagePattern":"CloudWatch retention period must be an integer, but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-retention-period.ts","lineNumber":30,"sourceCode":"\t\t\t\tperiod,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tif (Number.isNaN(period)) {\n\t\tthrow new TypeError(\n\t\t\t`CloudWatch retention period must be an integer, but is NaN`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(period)) {\n\t\tthrow new TypeError(\n\t\t\t`CloudWatch retention period must be finite, but is ${period}`,\n\t\t);\n\t}\n\n\tif (period % 1 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`CloudWatch retention period must be an integer, but is ${period}`,\n\t\t);\n\t}\n\n\tif (period < MIN_RETENTION_PERIOD) {\n\t\tthrow new Error(\n\t\t\t`CloudWatch retention period must be at least ${MIN_RETENTION_PERIOD}, but is ${period}`,\n\t\t);\n\t}\n\n\tif (period > MAX_RETENTION_PERIOD) {\n\t\tthrow new Error(\n\t\t\t`CloudWatch retention period must be at most ${MAX_RETENTION_PERIOD}, but is ${period}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":12,"sourceCodeEnd":47,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda/src/shared/validate-retention-period.ts#L12-L47","documentation":"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.","triggerScenarios":"Passing a fractional number such as 7.5, 0.1, or a computed average that produced a non-integer.","commonSituations":"Averaging retention values; arithmetic that yields a fraction; floating-point drift from prior calculations.","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."],"exampleFix":"// before\ndeployFunction({region, cloudWatchLogRetentionPeriodInDays: avg /* 7.5 */})\n// after\ndeployFunction({region, cloudWatchLogRetentionPeriodInDays: Math.round(avg)})","handlingStrategy":"validation","validationCode":"if (typeof period === 'number' && Number.isFinite(period) && !Number.isInteger(period)) {\n  throw new TypeError('retention must be an integer number of days')\n}","typeGuard":"const isIntegerDays = (v: unknown): v is number => Number.isInteger(v)","tryCatchPattern":null,"preventionTips":["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."],"tags":["aws","cloudwatch","validation","typescript"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}