🎥 Make videos programmatically with React
update docs
Jonny Burger747ffaa47373
diff --git a/packages/docs/docs/getfunctioninfo.md b/packages/docs/docs/getfunctioninfo.mdindex cfd9066cd7..6018d12107 100644--- a/packages/docs/docs/getfunctioninfo.md+++ b/packages/docs/docs/getfunctioninfo.md@@ -30,11 +30,11 @@ console.log(info.timeoutInSeconds) // 120## Arguments-An option containing the following properties:+An object containing the following properties:### `region`-The [region](/docs/lambda/region-selection) the function resides in.+The [AWS region](/docs/lambda/region-selection) the function resides in.### `functionName`diff --git a/packages/docs/docs/getfunctions.md b/packages/docs/docs/getfunctions.mdindex 22e124d416..f1b664e429 100644--- a/packages/docs/docs/getfunctions.md+++ b/packages/docs/docs/getfunctions.md@@ -3,3 +3,72 @@ title: getFunctions()id: getfunctionsslug: /lambda/getfunctions---++Retrieves a list of functions that Remotion deployed to AWS Lambda in a certain region.++The parameter `compatibleOnly` determines whether only functions that are compatible with the installed version of Remotion Lambda should be returned.++To get information about only a single function, use [`getFunctionInfo()`](/docs/lambda/getfunctioninfo)++## Example++```ts twoslash+// @module: esnext+// @target: es2017++import {getFunctions} from '@remotion/lambda';++const info = await getFunctions({+ region: 'eu-central-1',+ compatibleOnly: true+});++for (const fn of info) {+ console.log(fn.functionName) // "remotion-render-d8a03x"+ console.log(fn.memorySizeInMb) // 1536+ console.log(fn.timeoutInSeconds) // 120+ console.log(fn.version) // "2021-07-25"+}+```++## Argument++An object containing the following properties:++### `region`++The [AWS region](/docs/lambda/region-selection) that you would like to query.++### `compatibleOnly`++If true, only functions compatible with the currently installed Remotion Lambda version are returned.++## Return value++A promise resolving to an **array of objects** with the following properties:++### `functionName`++The name of the function.++### `memorySizeInMb`++The amount of memory allocated to the function.++### `functionName`++The name of the function.++### `version`++The version of the function. Remotion is [versioning](/docs/lambda/changelog) the Lambda function and a render can only be triggered from a version of `@remotion/lambda` that is matching the one of the function.++### `timeoutInSeconds`++The timeout that has been assigned to the Lambda function.++## See also++- [`getFunctionInfo()`](/docs/lambda/getfunctioninfo)+- [`deployFunction()`](/docs/lambda/deployfunction)+- [`deleteFunction()`](/docs/lambda/deletefunction)diff --git a/packages/docs/docs/getrenderprogress.md b/packages/docs/docs/getrenderprogress.mdindex 69867030bb..09476281cb 100644--- a/packages/docs/docs/getrenderprogress.md+++ b/packages/docs/docs/getrenderprogress.md@@ -37,7 +37,7 @@ The bucket in which information about the render is saved. You can get the bucke### `region`-The region in which the lambda function is located in.+The region in which the Lambda function is located in.### `functionName`diff --git a/packages/docs/docs/lambda-faq.md b/packages/docs/docs/lambda-faq.mdindex 9dde8dea6b..87d9e19c0a 100644--- a/packages/docs/docs/lambda-faq.md+++ b/packages/docs/docs/lambda-faq.md@@ -38,4 +38,4 @@ You can deploy a new function using:npx remotion lambda functions deploy```-If you are using the CLI, the following APIs are useful: [`getFunctions()`](/docs/lambda/getfunctions), [`deployFunction()`](/docs/lambda/deployfunction) and [`deleteFunction()`](/docs/lambda/deletefunction).+If you are using the Node.JS APIs, the following APIs are useful: [`getFunctions()`](/docs/lambda/getfunctions), [`deployFunction()`](/docs/lambda/deployfunction) and [`deleteFunction()`](/docs/lambda/deletefunction).diff --git a/packages/lambda/src/api/get-function-info.ts b/packages/lambda/src/api/get-function-info.tsindex dd9bccdedc..329600b10d 100644--- a/packages/lambda/src/api/get-function-info.ts+++ b/packages/lambda/src/api/get-function-info.ts@@ -5,7 +5,7 @@ import {LambdaVersions} from '../shared/constants';import {getFunctionVersion} from '../shared/get-function-version';import {validateAwsRegion} from '../shared/validate-aws-region';-type FunctionInfo = {+export type FunctionInfo = {functionName: string;timeoutInSeconds: number;memorySizeInMb: number;diff --git a/packages/lambda/src/api/get-functions.ts b/packages/lambda/src/api/get-functions.tsindex 5e066a2219..68b21e571d 100644--- a/packages/lambda/src/api/get-functions.ts+++ b/packages/lambda/src/api/get-functions.ts@@ -1,19 +1,9 @@import {ListFunctionsCommand} from '@aws-sdk/client-lambda';import {AwsRegion} from '../pricing/aws-regions';import {getLambdaClient} from '../shared/aws-clients';-import {- CURRENT_VERSION,- LambdaVersions,- RENDER_FN_PREFIX,-} from '../shared/constants';+import {CURRENT_VERSION, RENDER_FN_PREFIX} from '../shared/constants';import {getFunctionVersion} from '../shared/get-function-version';--type FunctionInfo = {- name: string;- version: LambdaVersions;- memoryInMb: number;- timeoutInSeconds: number;-};+import {FunctionInfo} from './get-function-info';/***@@ -47,9 +37,9 @@ export const getFunctions = async (options: {const list = remotionLambdas.map((lambda, i): FunctionInfo => {return {- name: lambda.FunctionName as string,+ functionName: lambda.FunctionName as string,version: configs[i],- memoryInMb: lambda.MemorySize as number,+ memorySizeInMb: lambda.MemorySize as number,timeoutInSeconds: lambda.Timeout as number,};});diff --git a/packages/lambda/src/cleanup/cleanup-lambdas.ts b/packages/lambda/src/cleanup/cleanup-lambdas.tsindex 5a9222e1e6..7458b86f0b 100644--- a/packages/lambda/src/cleanup/cleanup-lambdas.ts+++ b/packages/lambda/src/cleanup/cleanup-lambdas.ts@@ -17,12 +17,12 @@ export const cleanupLambdas = async ({}for (const lambda of remotionLambdas) {- onBeforeDelete?.(lambda.name);+ onBeforeDelete?.(lambda.functionName);await deleteFunction({region,- functionName: lambda.name,+ functionName: lambda.functionName,});- onAfterDelete?.(lambda.name);+ onAfterDelete?.(lambda.functionName);}await cleanupLambdas({region, onBeforeDelete, onAfterDelete});diff --git a/packages/lambda/src/cli/cleanup.ts b/packages/lambda/src/cli/cleanup.tsindex d3dcb84847..af62a61aff 100644--- a/packages/lambda/src/cli/cleanup.ts+++ b/packages/lambda/src/cli/cleanup.ts@@ -99,7 +99,7 @@ export const cleanupCommand = async (args: string[]) => {`${chunk(lambdas, 2).map((b) =>CliInternals.chalk.blue(- b.map((a) => (a.name ?? '').padEnd(40, ' ')).join(' ')+ b.map((a) => (a.functionName ?? '').padEnd(40, ' ')).join(' '))).join('\n')}`diff --git a/packages/lambda/src/cli/commands/functions/ls.ts b/packages/lambda/src/cli/commands/functions/ls.tsindex 8f09fdee60..33dfa87aca 100644--- a/packages/lambda/src/cli/commands/functions/ls.ts+++ b/packages/lambda/src/cli/commands/functions/ls.ts@@ -25,7 +25,7 @@ export const functionsLsCommand = async () => {});if (quiet) {- Log.info(functions.map((f) => f.name).join(' '));+ Log.info(functions.map((f) => f.functionName).join(' '));return;}@@ -50,9 +50,9 @@ export const functionsLsCommand = async () => {for (const datapoint of functions) {Log.info([- datapoint.name.padEnd(NAME_COLS, ' '),+ datapoint.functionName.padEnd(NAME_COLS, ' '),datapoint.version.padEnd(VERSION_COLS, ' '),- String(datapoint.memoryInMb).padEnd(MEMORY_COLS, ' '),+ String(datapoint.memorySizeInMb).padEnd(MEMORY_COLS, ' '),String(datapoint.timeoutInSeconds).padEnd(TIMEOUT_COLS, ' '),].join(''));diff --git a/packages/lambda/src/cli/render.ts b/packages/lambda/src/cli/render.tsindex 22b277d1e6..4e579eaa91 100644--- a/packages/lambda/src/cli/render.ts+++ b/packages/lambda/src/cli/render.ts@@ -74,7 +74,7 @@ export const renderCommand = async (args: string[]) => {process.exit(1);}- const functionName = lambdasWithMatchingVersion[0].name;+ const {functionName} = lambdasWithMatchingVersion[0];const cliOptions = await CliInternals.getCliOptions({isLambda: true});diff --git a/packages/lambda/src/run.ts b/packages/lambda/src/run.tsindex 970345370b..19d9437ca6 100644--- a/packages/lambda/src/run.ts+++ b/packages/lambda/src/run.ts@@ -69,7 +69,7 @@ const getFnName = async (options: {});const firstSite = firstBucket.find(() => true);return {- functionName: lambdas[0].name as string,+ functionName: lambdas[0].functionName as string,bucketUrl: makeS3Url({bucketName: websiteBuckets[0].Name as string,subFolder: firstSite?.Key?.match(/(sites\/.*)\//)?.[1] as string,