Skip to main content

getCompositionsOnLambda()

available from v3.3.2

Gets the compositions inside a Lambda function.

Note that you can also get the compositions of a site that is hosted on Lambda using getCompositions(). Vice versa, you can also get the compositions from a serve URL that is not hosted on AWS Lambda using getCompositionsOnLambda().

You should use getCompositionsOnLambda() if you cannot use getCompositions() because the machine cannot run Chrome.

Example

tsx
import { getCompositionsOnLambda } from "@remotion/lambda/client";
 
const compositions = await getCompositionsOnLambda({
region: "us-east-1",
functionName: "remotion-render-bds9aab",
serveUrl:
"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
inputProps: {},
});
 
console.log(compositions); // See below for an example value
tsx
import { getCompositionsOnLambda } from "@remotion/lambda/client";
 
const compositions = await getCompositionsOnLambda({
region: "us-east-1",
functionName: "remotion-render-bds9aab",
serveUrl:
"https://remotionlambda-qg35eyp1s1.s3.eu-central-1.amazonaws.com/sites/bf2jrbfkw",
inputProps: {},
});
 
console.log(compositions); // See below for an example value
note

Preferrably import this function from @remotion/lambda/client to avoid problems inside serverless functions.

Arguments

An object with the following properties:

functionName

The name of the deployed Lambda function that should be used to ge the list of compositions. Use deployFunction() to create a new function and getFunctions() to obtain currently deployed Lambdas.

region

In which region your Lambda function is deployed.

serveUrl

A URL pointing to a Remotion project. Use deploySite() to deploy a Remotion project.

inputProps

React props that can be obtained using getInputProps() from inside the React component while evaluating the list of compositions.

envVariables?

optional - default {}

See renderMedia() -> envVariables.

timeoutInMilliseconds?

A number describing how long the function may take in milliseconds to evaluate the list of compositions before it times out. Default: 30000

chromiumOptions?

Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.

disableWebSecurity

boolean - default false

This will most notably disable CORS among other security features.

ignoreCertificateErrors

boolean - default false

Results in invalid SSL certificates, such as self-signed ones, being ignored.

gl

string

Select the OpenGL renderer backend for Chromium. Accepted values:

  • "angle",
  • "egl",
  • "swiftshader"
  • "swangle"
  • null - Chromiums default
note

The default for Lambda is "swangle", but null elsewhere.

userAgent

Lets you set a custom user agent that the headless Chrome browser assumes.

forceBucketName?

available from v3.3.42

Specify a specific bucket name to be used. This is not recommended, instead let Remotion discover the right bucket automatically.

logLevel?

One of verbose, info, warn, error. Determines how much is being logged inside the Lambda function. Logs can be read through the CloudWatch URL that this function returns.

offthreadVideoCacheSizeInBytes?

dumpBrowserLogs?

optional - default false, deprecated in v4.0

Deprecated in favor of logLevel.

Return value

Returns a promise that resolves to an array of available compositions. Example value:

ts
[
{
id: "HelloWorld",
width: 1920,
height: 1080,
fps: 30,
durationInFrames: 120,
defaultProps: {
title: "Hello World",
},
},
{
id: "Title",
width: 1080,
height: 1080,
fps: 30,
durationInFrames: 90,
defaultProps: undefined,
},
];
ts
[
{
id: "HelloWorld",
width: 1920,
height: 1080,
fps: 30,
durationInFrames: 120,
defaultProps: {
title: "Hello World",
},
},
{
id: "Title",
width: 1080,
height: 1080,
fps: 30,
durationInFrames: 90,
defaultProps: undefined,
},
];