{"record":{"id":"1f6511fab2a80222","repo":"remotion-dev/remotion","slug":"cloudwatch-retention-period-must-be-finite-but-is","errorCode":null,"errorMessage":"CloudWatch retention period must be finite, but is ${period}","messagePattern":"CloudWatch retention period must be finite, but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-retention-period.ts","lineNumber":24,"sourceCode":"\t\treturn;\n\t}\n\n\tif (typeof period !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`CloudWatch retention period should be a number, got: ${JSON.stringify(\n\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(","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda/src/shared/validate-retention-period.ts#L6-L42","documentation":"Thrown by validateCloudWatchRetentionPeriod() (a TypeError) when the value is a non-NaN number but fails Number.isFinite() (i.e. Infinity or -Infinity). CloudWatch log retention must be a concrete day count.","triggerScenarios":"Passing Infinity produced by dividing by zero, by Math.pow overflow, or by parsing 'Infinity' through Number().","commonSituations":"Computing the retention from a formula that can divide by zero; defaulting to Infinity intending 'keep forever'; JSON that contained Infinity (non-standard but Number('Infinity') works).","solutions":["Use Number.isFinite() to reject Infinity before calling deployFunction.","Replace any 'keep forever' intent with the maximum allowed value (3650) or omit the field.","Audit formulas producing the retention value for divide-by-zero cases."],"exampleFix":"// before\nconst retention = totalDays / divisor  // divisor could be 0 -> Infinity\ndeployFunction({region, cloudWatchLogRetentionPeriodInDays: retention})\n// after\nconst retention = Number.isFinite(totalDays / divisor) ? totalDays / divisor : undefined\ndeployFunction({region, cloudWatchLogRetentionPeriodInDays: retention})","handlingStrategy":"validation","validationCode":"if (typeof period === 'number' && !Number.isFinite(period)) {\n  throw new TypeError('retention must be finite')\n}","typeGuard":"const isFiniteNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v)","tryCatchPattern":null,"preventionTips":["Reject Infinity at the config boundary with Number.isFinite().","Avoid 'Infinity as forever' sentinels; use the documented max (3650) or omit.","Audit retention formulas for divide-by-zero."],"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"}