Skip to content

🎥 Make videos programmatically with React

write documentation

Jonny Burgerae2c79a13a75
diff --git a/packages/docs/components/TableOfContents/lambda.tsx b/packages/docs/components/TableOfContents/lambda.tsx
index e6a9e9271e..eff0d13416 100644
--- a/packages/docs/components/TableOfContents/lambda.tsx
+++ b/packages/docs/components/TableOfContents/lambda.tsx
@@ -26,6 +26,10 @@ export const TableOfContents: React.FC = () => {
<strong>getFunctions()</strong>
<div>Lists available Remotion Lambda functions</div>
</TOCItem>
+ <TOCItem link="/docs/lambda/getcompositionsonlambda">
+ <strong>getCompositionsOnLambda()</strong>
+ <div>Gets list of compositions inside a Lambda function</div>
+ </TOCItem>
<TOCItem link="/docs/lambda/deletesite">
<strong>deleteSite()</strong>
<div>Delete a bundle from S3</div>
diff --git a/packages/docs/docs/lambda/getcompositionsonlambda.md b/packages/docs/docs/lambda/getcompositionsonlambda.md
new file mode 100644
index 0000000000..4fe098a15a
--- /dev/null
+++ b/packages/docs/docs/lambda/getcompositionsonlambda.md
@@ -0,0 +1,123 @@
+---
+id: getcompositionsonlambda
+title: getCompositionsOnLambda()
+slug: /lambda/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()`](/docs/renderer/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()`](/docs/renderer/getcompositions) because the machine cannot run Chrome.
+
+## Example
+
+```tsx twoslash
+// @module: esnext
+// @target: es2017
+import { getCompositionsOnLambda } from "@remotion/lambda";
+
+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: {},
+});
+```
+
+## 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()`](/docs/lambda/deployfunction) to create a new function and [`getFunctions()`](/docs/lambda/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()`](/docs/lambda/deploysite) to deploy a Remotion project.
+
+### `inputProps`
+
+React props that can be obtained using [`getInputProps()`](/docs/get-input-props) from inside the React component while evaluating the list of compositions.
+
+### `envVariables?`
+
+_optional - default `{}`_
+
+See [`renderMedia() -> envVariables`](/docs/renderer/render-media#envvariables).
+
+### `timeoutInMilliseconds?`
+
+A number describing how long the function may take in milliseconds to evaluate the list of compositions [before it times out](/docs/timeout). Default: `30000`
+
+### `chromiumOptions?`
+
+Allows you to set certain Chromium / Google Chrome flags. See: [Chromium flags](/docs/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.
+:::
+
+## Return value
+
+Returns a promise that resolves to an array of available compositions. Example value:
+
+```ts twoslash
+[
+ {
+ 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,
+ },
+];
+```
+
+- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/api/get-compositions-on-lambda.ts)
+- [getCompositions()](/docs/renderer/get-compositions)
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index ba7b143080..9655992d11 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -182,6 +182,7 @@ module.exports = {
"lambda/deleterender",
"lambda/getuserpolicy",
"lambda/getrolepolicy",
+ "lambda/getcompositionsonlambda",
"lambda/getorcreatebucket",
"lambda/getrenderprogress",
"lambda/presignurl",
diff --git a/packages/lambda/src/api/get-compositions-on-lambda.ts b/packages/lambda/src/api/get-compositions-on-lambda.ts
index 94e5d042c8..3cf4404127 100644
--- a/packages/lambda/src/api/get-compositions-on-lambda.ts
+++ b/packages/lambda/src/api/get-compositions-on-lambda.ts
@@ -18,9 +18,7 @@ export type GetCompositionsOnLambdaInput = {
timeoutInMilliseconds?: number;
};
-export type GetCompositionsOnLambdaOutput = {
- compositions: TCompMetadata[];
-};
+export type GetCompositionsOnLambdaOutput = TCompMetadata[];
/**
* @description Returns the compositions from a serveUrl
@@ -68,9 +66,7 @@ export const getCompositionsOnLambda = async ({
},
region,
});
- return {
- compositions: res.compositions,
- };
+ return res.compositions;
} catch (err) {
if ((err as Error).stack?.includes('UnrecognizedClientException')) {
throw new Error(