remotion-dev/remotion · error · TypeError

The 'expiresIn' parameter must be greater or equal than ${MI

Error message

The 'expiresIn' parameter must be greater or equal than ${MIN_PRESIGN_EXPIRATION}

What it means

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.

Source

Thrown at packages/lambda-client/src/validate-presign-expiration.ts:42

		);
	}

	if (presignExpiration % 1 !== 0) {
		throw new TypeError(
			`'expiresIn' should be an integer but is ${JSON.stringify(
				presignExpiration,
			)}`,
		);
	}

	if (presignExpiration > MAX_PRESIGN_EXPIRATION) {
		throw new TypeError(
			`The 'expiresIn' parameter must be less or equal than ${MAX_PRESIGN_EXPIRATION} (7 days) as enforced by AWS`,
		);
	}

	if (presignExpiration < MIN_PRESIGN_EXPIRATION) {
		throw new TypeError(
			`The 'expiresIn' parameter must be greater or equal than ${MIN_PRESIGN_EXPIRATION}`,
		);
	}
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure expiresIn is at least 1 (and realistically a few minutes, e.g. 3600).
  2. If the value is optional, pass undefined instead of 0 to use the library default.
  3. Validate date-difference formulas with Math.max(diff, 1).

Example fix

// before
const expiresIn = expiryEpoch - Date.now() / 1000; // 0 or negative
await renderMediaOnLambda({..., opts: {expiresIn}});

// after
const expiresIn = Math.max(Math.round((expiryEpoch - Date.now()) / 1000), 1);
await renderMediaOnLambda({..., opts: {expiresIn}});
Defensive patterns

Strategy: validation

Validate before calling

const expiresIn = Math.max(Math.round(Number(input)), 1);

Type guard

const isPositiveExpiresIn = (v: unknown): v is number =>
  typeof v === 'number' && Number.isFinite(v) && v % 1 === 0 && v >= 1;

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/dfa53c77cc837493. Report an issue: GitHub.