{"record":{"id":"fc7610aee246e51c","repo":"remotion-dev/remotion","slug":"cloudwatch-retention-period-must-be-at-least-min","errorCode":null,"errorMessage":"CloudWatch retention period must be at least ${MIN_RETENTION_PERIOD}, but is ${period}","messagePattern":"CloudWatch retention period must be at least (.+?), but is (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda/src/shared/validate-retention-period.ts","lineNumber":36,"sourceCode":"\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":18,"sourceCodeEnd":47,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda/src/shared/validate-retention-period.ts#L18-L47","documentation":"Thrown by validateCloudWatchRetentionPeriod() (an Error) when the integer value is below the minimum of 1 day. CloudWatch does not support a sub-1-day retention policy, so values <= 0 are rejected after the type/finite/integer checks pass.","triggerScenarios":"Passing 0 or a negative integer as the retention period, often intending 'no retention' or 'default'.","commonSituations":"Confusing 0 with 'no policy' (you should pass undefined/null instead); accidental sign inversion; defaulting to 0 in config.","solutions":["To disable a custom retention policy, omit the field or pass null/undefined.","Otherwise pass an integer >= 1 (and <= 3650).","Validate the range in your config layer before calling deployFunction."],"exampleFix":"// before\ndeployFunction({region, cloudWatchLogRetentionPeriodInDays: 0})\n// after - to disable custom retention:\ndeployFunction({region, cloudWatchLogRetentionPeriodInDays: undefined})","handlingStrategy":"validation","validationCode":"const MIN = 1\nif (typeof period === 'number' && period < MIN) {\n  throw new Error(`retention must be >= ${MIN}; pass undefined to skip`)\n}","typeGuard":"const isRetentionInRange = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isInteger(v) && v >= 1 && v <= 3650","tryCatchPattern":null,"preventionTips":["Use undefined/null (not 0) to mean 'no custom retention'.","Validate the 1..3650 range in your config layer.","Document the meaning of 'unset' vs. a numeric value for operators."],"tags":["aws","cloudwatch","validation","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}