🎥 Make videos programmatically with React
implement for getCompositionsOnLambda()
Jonny Burgerabbae73752b5
diff --git a/packages/docs/docs/lambda/getcompositionsonlambda.md b/packages/docs/docs/lambda/getcompositionsonlambda.mdindex 6662373817..8f23953235 100644--- a/packages/docs/docs/lambda/getcompositionsonlambda.md+++ b/packages/docs/docs/lambda/getcompositionsonlambda.md@@ -106,6 +106,16 @@ _available from v3.3.42_Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), 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.++If the `logLevel` is set to `verbose`, the `dumpBrowserLogs` flag will also be enabled.++### `dumpBrowserLogs?` <AvailableFrom v="3.3.83" />++If set to true, all `console` statements from the headless browser will be forwarded to the CloudWatch logs.+## Return valueReturns a promise that resolves to an array of available compositions. Example value:diff --git a/packages/lambda/src/api/get-compositions-on-lambda.ts b/packages/lambda/src/api/get-compositions-on-lambda.tsindex a7cd2bc948..8531cf1365 100644--- a/packages/lambda/src/api/get-compositions-on-lambda.ts+++ b/packages/lambda/src/api/get-compositions-on-lambda.ts@@ -16,6 +16,7 @@ export type GetCompositionsOnLambdaInput = {logLevel?: LogLevel;timeoutInMilliseconds?: number;forceBucketName?: string;+ dumpBrowserLogs?: boolean;};export type GetCompositionsOnLambdaOutput = TCompMetadata[];@@ -31,6 +32,7 @@ export type GetCompositionsOnLambdaOutput = TCompMetadata[];* @param params.logLevel The log level of the Lambda function* @param params.timeoutInMilliseconds The timeout of the Lambda function* @param params.chromiumOptions The options to pass to Chromium+ * @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch* @returns The compositions*/export const getCompositionsOnLambda = async ({@@ -43,6 +45,7 @@ export const getCompositionsOnLambda = async ({logLevel,timeoutInMilliseconds,forceBucketName: bucketName,+ dumpBrowserLogs,}: GetCompositionsOnLambdaInput): Promise<GetCompositionsOnLambdaOutput> => {const serializedInputProps = await serializeInputProps({inputProps,@@ -64,6 +67,7 @@ export const getCompositionsOnLambda = async ({timeoutInMilliseconds: timeoutInMilliseconds ?? 30000,version: VERSION,bucketName: bucketName ?? null,+ dumpBrowserLogs: dumpBrowserLogs ?? false,},region,});diff --git a/packages/lambda/src/api/render-media-on-lambda.ts b/packages/lambda/src/api/render-media-on-lambda.tsindex 1d9eb906ad..a8fb62b528 100644--- a/packages/lambda/src/api/render-media-on-lambda.ts+++ b/packages/lambda/src/api/render-media-on-lambda.ts@@ -87,6 +87,7 @@ export type RenderMediaOnLambdaOutput = {* @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted. Default "1"* @param params.logLevel Level of logging that Lambda function should perform. Default "info".* @param params.webhook Configuration for webhook called upon completion or timeout of the render.+ * @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure*/diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.tsindex afcde862e5..7846564f4c 100644--- a/packages/lambda/src/api/render-still-on-lambda.ts+++ b/packages/lambda/src/api/render-still-on-lambda.ts@@ -59,6 +59,7 @@ export type RenderStillOnLambdaOutput = {* @param params.maxRetries How often rendering a chunk may fail before the video render gets aborted.* @param params.frame Which frame should be used for the still image. Default 0.* @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`+ * @param params.dumpBrowserLogs Whether to print browser logs to CloudWatch.* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.*/diff --git a/packages/lambda/src/functions/compositions.ts b/packages/lambda/src/functions/compositions.tsindex bd6c7fb13a..f485e5821c 100644--- a/packages/lambda/src/functions/compositions.ts+++ b/packages/lambda/src/functions/compositions.ts@@ -40,7 +40,11 @@ export const compositionsHandler = async (region,}).then((b) => b.bucketName),getBrowserInstance(- RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'),+ lambdaParams.dumpBrowserLogs ??+ RenderInternals.isEqualOrBelowLogLevel(+ lambdaParams.logLevel,+ 'verbose'+ ),lambdaParams.chromiumOptions ?? {}),]);diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.tsindex a06be43af2..fec860710d 100644--- a/packages/lambda/src/shared/constants.ts+++ b/packages/lambda/src/shared/constants.ts@@ -373,6 +373,7 @@ export type LambdaPayloads = {timeoutInMilliseconds: number;serveUrl: string;bucketName: string | null;+ dumpBrowserLogs: boolean;};};