Skip to main content

speculateFunctionName()

available from v3.3.75

Speculate the name of the Lambda function that will be created by deployFunction() or its CLI equivalent, npx remotion lambda functions deploy. This could be useful in cases when the configuration of the Lambda function is known in advance, and the name of the function is needed.

If you are not sure whether a function exists, use getFunctionInfo() and catch the error that gets thrown if it does not exist.

If you want to get a list of deployed functions, use getFunctions() instead.

Function name pattern

A Remotion Lambda function is always names like this:

txt
remotion-render-3-3-63-mem2048mb-disk2048mb-240sec
^^^^^^ ^^^^ ^^^ ^^^
| | | |-- Timeout in seconds
| | |--------- Disk size in MB
| |------------------- Memory size in MB
|----------------------------- Remotion version with dots replaced by dashes
txt
remotion-render-3-3-63-mem2048mb-disk2048mb-240sec
^^^^^^ ^^^^ ^^^ ^^^
| | | |-- Timeout in seconds
| | |--------- Disk size in MB
| |------------------- Memory size in MB
|----------------------------- Remotion version with dots replaced by dashes

Learn more about this convention.

Example

ts
import { speculateFunctionName } from "@remotion/lambda/client";
 
const speculatedFunctionName = speculateFunctionName({
memorySizeInMb: 2048,
diskSizeInMb: 2048,
timeoutInSeconds: 120,
});
 
console.log(speculatedFunctionName); // remotion-render-3-3-63-mem2048mb-disk2048mb-120sec
ts
import { speculateFunctionName } from "@remotion/lambda/client";
 
const speculatedFunctionName = speculateFunctionName({
memorySizeInMb: 2048,
diskSizeInMb: 2048,
timeoutInSeconds: 120,
});
 
console.log(speculatedFunctionName); // remotion-render-3-3-63-mem2048mb-disk2048mb-120sec

Arguments

An object with the following properties:

memorySizeInMb

The amount of memory allocated to the function.

diskSizeInMb

The amount of disk space allocated to the function.

timeoutInSeconds

The timeout that has been assigned to the Lambda function.

Return value

A string with the name of the function that will be created.

See also