remotion-dev/remotion · error · TypeError
Parameter 'durationInMilliseconds' must be a number but got
Error message
Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds} What it means
estimatePrice runs a typeof check on the resolved durationInMilliseconds and throws a TypeError if it is not a number. The function accepts both the deprecated typo key durationInMiliseconds and the correct durationInMilliseconds, so a non-number usually means neither key was supplied (undefined) or a string/other type was passed.
Source
Thrown at packages/lambda-client/src/estimate-price.ts:47
*/
export const estimatePrice = ({
region,
memorySizeInMb,
diskSizeInMb,
lambdasInvoked,
...other
}: EstimatePriceInput): number => {
validateMemorySize(memorySizeInMb);
validateAwsRegion(region);
validateDiskSizeInMb(diskSizeInMb);
const durationInMilliseconds =
'durationInMiliseconds' in other
? other.durationInMiliseconds
: other.durationInMilliseconds;
if (typeof durationInMilliseconds !== 'number') {
throw new TypeError(
`Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds}`,
);
}
if (Number.isNaN(durationInMilliseconds)) {
throw new TypeError(
`Parameter 'durationInMilliseconds' must not be NaN but it is.`,
);
}
if (!Number.isFinite(durationInMilliseconds)) {
throw new TypeError(
`Parameter 'durationInMilliseconds' must be finite but it is ${durationInMilliseconds}`,
);
}
if (durationInMilliseconds < 0) {
throw new TypeError(View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass durationInMilliseconds as a number
- If using the deprecated durationInMiliseconds typo, rename it to durationInMilliseconds
- Coerce/Number() only after confirming the source value is numeric
Example fix
// before
estimatePrice({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked });
// after
estimatePrice({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, durationInMilliseconds: 5000 }); Defensive patterns
Strategy: validation
Validate before calling
function assertDuration(v: unknown): asserts v is number {
if (typeof v !== 'number') {
throw new TypeError('durationInMilliseconds must be a number');
}
} Type guard
const isDuration = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v) && Number.isFinite(v) && v >= 0;
Prevention
- Type the call site strictly so omitted durationInMilliseconds is a compile error
- Migrate any durationInMiliseconds (typo) usages to durationInMilliseconds
- Validate at the boundary where user input enters
When it happens
Trigger: Calling estimatePrice with no durationInMilliseconds (and no durationInMiliseconds), or with a non-numeric value such as a string.
Common situations: Object spread that dropped the field, renamed prop without updating call site, passing a string from user input.
Related errors
- Parameter 'durationInMilliseconds' must not be NaN but it is
- Parameter 'durationInMilliseconds' must be finite but it is
- Parameter 'durationInMilliseconds' must be over 0 but it is
- inputRange must contain only numbers
- outputStyles must contain only objects
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/e29be929585f0aae.
Report an issue: GitHub.