{"record":{"id":"dfa53c77cc837493","repo":"remotion-dev/remotion","slug":"the-expiresin-parameter-must-be-greater-or-equal","errorCode":null,"errorMessage":"The 'expiresIn' parameter must be greater or equal than ${MIN_PRESIGN_EXPIRATION}","messagePattern":"The 'expiresIn' parameter must be greater or equal than (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/validate-presign-expiration.ts","lineNumber":42,"sourceCode":"\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\n\tif (presignExpiration < MIN_PRESIGN_EXPIRATION) {\n\t\tthrow new TypeError(\n\t\t\t`The 'expiresIn' parameter must be greater or equal than ${MIN_PRESIGN_EXPIRATION}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":24,"sourceCodeEnd":47,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/validate-presign-expiration.ts#L24-L47","documentation":"Thrown by validatePresignExpiration() when expiresIn is an integer less than 1. A presigned URL must be valid for at least one second; zero or negative TTLs produce a URL that is already expired at issue time.","triggerScenarios":"Passing expiresIn: 0, expiresIn: -1, or a value computed from a subtraction that goes negative (e.g. now - issuedAt where issuedAt is in the future).","commonSituations":"Defaulting an unset field to 0 instead of undefined; computing TTL as a date delta that yields 0 or negative when dates are equal or inverted.","solutions":["Ensure expiresIn is at least 1 (and realistically a few minutes, e.g. 3600).","If the value is optional, pass undefined instead of 0 to use the library default.","Validate date-difference formulas with Math.max(diff, 1)."],"exampleFix":"// before\nconst expiresIn = expiryEpoch - Date.now() / 1000; // 0 or negative\nawait renderMediaOnLambda({..., opts: {expiresIn}});\n\n// after\nconst expiresIn = Math.max(Math.round((expiryEpoch - Date.now()) / 1000), 1);\nawait renderMediaOnLambda({..., opts: {expiresIn}});","handlingStrategy":"validation","validationCode":"const expiresIn = Math.max(Math.round(Number(input)), 1);","typeGuard":"const isPositiveExpiresIn = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v % 1 === 0 && v >= 1;","tryCatchPattern":null,"preventionTips":["Pass undefined instead of 0 to use the default.","Use Math.max(diff, 1) on any TTL computed from a date delta.","Validate config defaults at boot, not at request time."],"tags":["lambda","validation","aws","presign"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}