{"record":{"id":"158664e54535644c","repo":"remotion-dev/remotion","slug":"expected-deleteafter-value-to-be-one-of-object-k","errorCode":null,"errorMessage":"Expected deleteAfter value to be one of ${Object.keys(expiryDays).join(', ')}, got ${lifeCycleValue}","messagePattern":"Expected deleteAfter value to be one of (.+?), got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/aws-provider.ts","lineNumber":92,"sourceCode":"const validateDeleteAfter = (lifeCycleValue: unknown) => {\n\tif (lifeCycleValue === null) {\n\t\treturn;\n\t}\n\n\tif (lifeCycleValue === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof lifeCycleValue !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected life cycle value to be a string, got ${JSON.stringify(\n\t\t\t\tlifeCycleValue,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tif (!(lifeCycleValue in expiryDays)) {\n\t\tthrow new TypeError(\n\t\t\t`Expected deleteAfter value to be one of ${Object.keys(expiryDays).join(\n\t\t\t\t', ',\n\t\t\t)}, got ${lifeCycleValue}`,\n\t\t);\n\t}\n};\n\nexport const awsImplementation: ProviderSpecifics<AwsProvider> = {\n\tgetChromiumPath() {\n\t\treturn '/opt/bin/chromium';\n\t},\n\tgetBuckets: getRemotionBuckets,\n\tcreateBucket,\n\tapplyLifeCycle: applyLifeCyleOperation,\n\tlistObjects: lambdaLsImplementation,\n\tdeleteFile: lambdaDeleteFileImplementation,\n\tbucketExists: bucketExistsInRegionImplementation,\n\trandomHash: randomHashImplementation,","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/aws-provider.ts#L74-L110","documentation":"Thrown by validateDeleteAfter() in @remotion/lambda-client when deleteAfter is a string but not one of the allowed lifecycle keys. Allowed keys (from the expiryDays map) are exactly: '1-day', '3-days', '7-days', '30-days'. The value is used as an S3 lifecycle expiration identifier, so it must match a known key.","triggerScenarios":"Passing deleteAfter: '7' (bare number-as-string), '7days' (no dash), '7-days ' (trailing space), '14-days', '90-days', or any other string not in the allowed set.","commonSituations":"Dropping the dash, pluralizing wrong ('1-days'), using a duration the map doesn't support (e.g. 14 or 90 days), or copy-pasting a value from another tool's format.","solutions":["Use exactly one of: '1-day', '3-days', '7-days', '30-days'.","If you need a different retention, pick the nearest supported bucket or manage the S3 lifecycle rule directly.","Trim and validate against the list before passing."],"exampleFix":"// before\nawait cleanUpS3Files({ deleteAfter: '7' });\n\n// after\nawait cleanUpS3Files({ deleteAfter: '7-days' });","handlingStrategy":"validation","validationCode":"const ALLOWED = ['1-day', '3-days', '7-days', '30-days'] as const;\nconst deleteAfter = (ALLOWED as readonly string[]).includes(raw) ? (raw as any) : undefined;","typeGuard":"const isDeleteAfterKey = (v: unknown): v is '1-day' | '3-days' | '7-days' | '30-days' =>\n  typeof v === 'string' && ['1-day', '3-days', '7-days', '30-days'].includes(v);","tryCatchPattern":null,"preventionTips":["Use the exact keys with the dash: '1-day', '3-days', '7-days', '30-days'.","Trim whitespace before comparing.","If you need a custom retention, manage the S3 lifecycle rule directly via the AWS SDK."],"tags":["lambda-client","validation","lifecycle","s3","delete-after","configuration","enum"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}