remotion-dev/remotion · error · TypeError
Expected life cycle value to be a string, got ${JSON.stringi
Error message
Expected life cycle value to be a string, got ${JSON.stringify(lifeCycleValue)} What it means
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.
Source
Thrown at packages/lambda-client/src/aws-provider.ts:84
// @ts-expect-error
globalThis._dumpUnreleasedBuffers = new EventEmitter();
// @ts-expect-error
(globalThis._dumpUnreleasedBuffers as EventEmitter).setMaxListeners(201);
}
const validateDeleteAfter = (lifeCycleValue: unknown) => {
if (lifeCycleValue === null) {
return;
}
if (lifeCycleValue === undefined) {
return;
}
if (typeof lifeCycleValue !== 'string') {
throw new TypeError(
`Expected life cycle value to be a string, got ${JSON.stringify(
lifeCycleValue,
)}`,
);
}
if (!(lifeCycleValue in expiryDays)) {
throw new TypeError(
`Expected deleteAfter value to be one of ${Object.keys(expiryDays).join(
', ',
)}, got ${lifeCycleValue}`,
);
}
};
export const awsImplementation: ProviderSpecifics<AwsProvider> = {
getChromiumPath() {
return '/opt/bin/chromium';View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
// before
await cleanUpS3Files({ deleteAfter: 7 }); // number, not the enum string
// after
await cleanUpS3Files({ deleteAfter: '7-days' }); Defensive patterns
Strategy: type-guard
Validate before calling
const DELETE_AFTER = new Set(['1-day', '3-days', '7-days', '30-days']);
function toDeleteAfter(v: unknown): '1-day' | '3-days' | '7-days' | '30-days' | undefined {
return typeof v === 'string' && DELETE_AFTER.has(v) ? (v as any) : undefined;
} Type guard
const isDeleteAfter = (v: unknown): v is '1-day' | '3-days' | '7-days' | '30-days' => typeof v === 'string' && ['1-day', '3-days', '7-days', '30-days'].includes(v);
Prevention
- 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.
When it happens
Trigger: 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).
Common situations: Assuming deleteAfter takes a day count and passing 7 instead of '7-days'; reading a numeric value from config and forwarding it raw.
Related errors
- Expected deleteAfter value to be one of ${Object.keys(expiry
- Pass --s3-output-provider-endpoint when using S3 output prov
- Pass --force-bucket-name when using S3 output provider flags
- Pass --out-name when using S3 output provider flags.
- The 'siteName' argument must be a string if provided, but is
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/cd5a4390d8f8db77.
Report an issue: GitHub.