{"record":{"id":"444e72f32a2498b5","repo":"remotion-dev/remotion","slug":"expiresin-should-be-finite-but-is-presignexpir","errorCode":null,"errorMessage":"'expiresIn' should be finite but is ${presignExpiration}","messagePattern":"'expiresIn' should be finite but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/validate-presign-expiration.ts","lineNumber":22,"sourceCode":"export const validatePresignExpiration = (presignExpiration: unknown) => {\n\tif (typeof presignExpiration === 'undefined' || presignExpiration === null) {\n\t\treturn;\n\t}\n\n\tif (typeof presignExpiration !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`'expiresIn' should be a number, but is ${JSON.stringify(\n\t\t\t\tpresignExpiration,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tif (Number.isNaN(presignExpiration)) {\n\t\tthrow new TypeError(`'expiresIn' should not be NaN, but is NaN`);\n\t}\n\n\tif (!Number.isFinite(presignExpiration)) {\n\t\tthrow new TypeError(\n\t\t\t`'expiresIn' should be finite but is ${presignExpiration}`,\n\t\t);\n\t}\n\n\tif (presignExpiration % 1 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`'expiresIn' should be an integer but is ${JSON.stringify(\n\t\t\t\tpresignExpiration,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tif (presignExpiration > MAX_PRESIGN_EXPIRATION) {\n\t\tthrow new TypeError(\n\t\t\t`The 'expiresIn' parameter must be less or equal than ${MAX_PRESIGN_EXPIRATION} (7 days) as enforced by AWS`,\n\t\t);\n\t}\n","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/validate-presign-expiration.ts#L4-L40","documentation":"Thrown by validatePresignExpiration() when expiresIn is a number, not NaN, but not finite (Infinity or -Infinity). AWS limits presigned URL lifetimes to a maximum of 604800 seconds (7 days); an infinite TTL is impossible.","triggerScenarios":"Passing expiresIn: Number('Infinity'), parseFloat('Infinity'), or any computation that overflows to Infinity (e.g. division by zero).","commonSituations":"A config field accepting the literal 'Infinity'; a formula like maxValue / count where count is zero.","solutions":["Clamp the value with Math.min(value, 604800) and reject -Infinity / negative values up front.","Use Number.isFinite() and fall back to undefined if the input is non-finite.","Audit the formula generating expiresIn for divisions by zero."],"exampleFix":"// before\nconst expiresIn = totalSeconds / 0; // Infinity\nawait renderMediaOnLambda({..., opts: {expiresIn}});\n\n// after\nconst raw = totalSeconds / divisor;\nconst expiresIn = Number.isFinite(raw) ? Math.min(raw, 604800) : undefined;\nawait renderMediaOnLambda({..., opts: {expiresIn}});","handlingStrategy":"validation","validationCode":"const raw = Number(input);\nconst expiresIn = Number.isFinite(raw) ? Math.min(raw, 604800) : undefined;","typeGuard":"const isFiniteExpiresIn = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v);","tryCatchPattern":null,"preventionTips":["Reject 'Infinity' literals at the parsing layer.","Clamp computed TTLs against the 604800 ceiling.","Audit divisions in TTL formulas for zero divisors."],"tags":["lambda","validation","typescript","presign"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}