{"record":{"id":"cd5a4390d8f8db77","repo":"remotion-dev/remotion","slug":"expected-life-cycle-value-to-be-a-string-got-js","errorCode":null,"errorMessage":"Expected life cycle value to be a string, got ${JSON.stringify(lifeCycleValue)}","messagePattern":"Expected life cycle value to be a string, got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/aws-provider.ts","lineNumber":84,"sourceCode":"\n\t// @ts-expect-error\n\tglobalThis._dumpUnreleasedBuffers = new EventEmitter();\n\n\t// @ts-expect-error\n\t(globalThis._dumpUnreleasedBuffers as EventEmitter).setMaxListeners(201);\n}\n\nconst 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';","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/aws-provider.ts#L66-L102","documentation":"Thrown by validateDeleteAfter() (exposed via the AWS provider in @remotion/lambda-client) when the 'deleteAfter' lifecycle value is not null/undefined and not a string. deleteAfter controls the S3 lifecycle rule that auto-deletes render artifacts after a fixed number of days. null and undefined are explicitly allowed (both return early), so only other non-string types throw.","triggerScenarios":"Passing deleteAfter as a number (e.g. 7, intending '7 days'), a boolean, an object, or an array to an API that applies lifecycle rules (cleanUpS3Files / deployFunction / bucket lifecycle helpers).","commonSituations":"Assuming deleteAfter takes a day count and passing 7 instead of '7-days'; reading a numeric value from config and forwarding it raw.","solutions":["Pass one of the string enum values: '1-day', '3-days', '7-days', or '30-days'.","Pass null or undefined to disable the lifecycle rule.","Map a numeric day count to the closest allowed key before calling."],"exampleFix":"// before\nawait cleanUpS3Files({ deleteAfter: 7 }); // number, not the enum string\n\n// after\nawait cleanUpS3Files({ deleteAfter: '7-days' });","handlingStrategy":"type-guard","validationCode":"const DELETE_AFTER = new Set(['1-day', '3-days', '7-days', '30-days']);\nfunction toDeleteAfter(v: unknown): '1-day' | '3-days' | '7-days' | '30-days' | undefined {\n  return typeof v === 'string' && DELETE_AFTER.has(v) ? (v as any) : undefined;\n}","typeGuard":"const isDeleteAfter = (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":["Type deleteAfter as the string enum (keyof typeof expiryDays), never number.","Allow null/undefined explicitly in your schema to mean 'no lifecycle rule'.","Map day counts to the nearest allowed key at the config boundary."],"tags":["lambda-client","validation","lifecycle","s3","delete-after","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}