🎥 Make videos programmatically with React
document getfunctioninfo
Jonny Burger946a0c7b2b2a
diff --git a/packages/docs/docs/ensurelambdabinaries.md b/packages/docs/docs/ensurelambdabinaries.mdindex bd9dc4f3b3..5b5841e8b6 100644--- a/packages/docs/docs/ensurelambdabinaries.md+++ b/packages/docs/docs/ensurelambdabinaries.md@@ -20,7 +20,9 @@ This value is hardcoded into the `ensureLambdaBinaries()` function - you only ne## Example-```ts+```ts twoslash+// @module: esnext+// @target: es2017import {ensureLambdaBinaries} from '@remotion/lambda';// ...diff --git a/packages/docs/docs/getfunctioninfo.md b/packages/docs/docs/getfunctioninfo.mdindex 661696f1fe..cfd9066cd7 100644--- a/packages/docs/docs/getfunctioninfo.md+++ b/packages/docs/docs/getfunctioninfo.md@@ -3,3 +3,65 @@ id: getfunctioninfotitle: getFunctionInfo()slug: /lambda/getfunctioninfo---++Gets information about a function given it's name and region.++To get a list of deployed functions, use [`getFunctions()`](/docs/lambda/getfunctions).++To deploy a function, use [`deployFunction()`](/docs/lambda/deployfunction).++## Example++```ts twoslash+// @module: esnext+// @target: es2017++import {getFunctionInfo} from '@remotion/lambda';++const info = await getFunctionInfo({+ functionName: 'remotion-render-d7nd2a9f',+ region: 'eu-central-1'+});+console.log(info.functionName) // remotion-render-d7nd2a9f+console.log(info.memorySizeInMb) // 1500+console.log(info.version) // '2021-07-14'+console.log(info.timeoutInSeconds) // 120+```++## Arguments++An option containing the following properties:++### `region`++The [region](/docs/lambda/region-selection) the function resides in.++### `functionName`++The name of the function.++## Return value++A promise resolving to an object with the following properties:++### `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++- [`getFunctions()`](/docs/lambda/getfunctions)+- [`deployFunction()`](/docs/lambda/deployfunction)+- [`deleteFunction()`](/docs/lambda/deletefunction)diff --git a/packages/docs/docs/getfunctions.md b/packages/docs/docs/getfunctions.mdindex b7eb981d60..22e124d416 100644--- a/packages/docs/docs/getfunctions.md+++ b/packages/docs/docs/getfunctions.md@@ -1,5 +1,5 @@----title: getDeployedLambdas()-id: getdeployedlambdas-slug: /lambda/getdeployedlambdas+title: getFunctions()+id: getfunctions+slug: /lambda/getfunctions---diff --git a/packages/docs/docs/lambda-faq.md b/packages/docs/docs/lambda-faq.mdindex 472ef1de60..9dde8dea6b 100644--- a/packages/docs/docs/lambda-faq.md+++ b/packages/docs/docs/lambda-faq.md@@ -10,6 +10,10 @@ Some commonly asked questions about Remotion Lambda.No, you only need to deploy one function and it will be capable of rendering multiple videos, even across different projects.+### What if I want to render longer videos?++You don't need to worry about the timeout of a Lambda function because Remotion splits the video in many parts and renders them in parallel. However, you need to be aware of the 512MB storage limit that may not be exceeded. See: [Storage space](/docs/lambda/runtime#storage-space)+### Why are you not using Amazon EFS?We have evaluated Amazon Elastic File System (EFS) and we found the speed benefits of EFS are not substantial enough to warrant the increased complexity - for EFS to be integrated, VPC and security groups need to be created which will disable public internet access. To restore public internet access, a persistent EC2 instance needs to be created for proxying the traffic, negating many benefits of Lambda.diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.jsindex b28c8ece45..e2413d9c28 100644--- a/packages/docs/sidebars.js+++ b/packages/docs/sidebars.js@@ -19,14 +19,14 @@ module.exports = {items: ["calculateprice","deployfunction",- "deployproject","deletefunction",- "ensurelambdabinaries","getfunctioninfo","getfunctionversion",+ "getfunctions",+ "deployproject",+ "ensurelambdabinaries","getuserpolicy","getrolepolicy",- "getfunctions","getorcreatebucket","getrenderprogress","rendervideoonlambda",diff --git a/packages/lambda/src/api/get-function-info.ts b/packages/lambda/src/api/get-function-info.tsindex ccf4bf2658..af3daac30b 100644--- a/packages/lambda/src/api/get-function-info.ts+++ b/packages/lambda/src/api/get-function-info.ts@@ -1,16 +1,32 @@import {GetFunctionCommand} from '@aws-sdk/client-lambda';import {AwsRegion} from '../pricing/aws-regions';import {getLambdaClient} from '../shared/aws-clients';+import {LambdaVersions} from '../shared/constants';import {validateAwsRegion} from '../shared/validate-aws-region';import {getFunctionVersion} from './get-function-version';+type FunctionInfo = {+ functionName: string;+ timeoutInSeconds: number;+ memorySizeInMb: number;+ version: LambdaVersions;+};++type GetFunctionInfoArgs = {+ region: AwsRegion;+ functionName: string;+};++/**+ * @description Given a region and function name, returns information about the function such as version, memory size and timeout.+ * @param {AwsRegion} options.region The region in which the function resides in.+ * @param {string} options.functionName The name of the function+ * @return {Promise<FunctionInfo>} Promise resolving to information about the function.+ */export const getFunctionInfo = async ({region,functionName,-}: {- region: AwsRegion;- functionName: string;-}) => {+}: GetFunctionInfoArgs): Promise<FunctionInfo> => {validateAwsRegion(region);const [functionInfo, version] = await Promise.all([@@ -27,8 +43,8 @@ export const getFunctionInfo = async ({return {functionName,- timeout: functionInfo.Configuration?.Timeout as number,- memorySize: functionInfo.Configuration?.MemorySize as number,+ timeoutInSeconds: functionInfo.Configuration?.Timeout as number,+ memorySizeInMb: functionInfo.Configuration?.MemorySize as number,version,};};diff --git a/packages/lambda/src/cli/commands/functions/rm.ts b/packages/lambda/src/cli/commands/functions/rm.tsindex 951f2fd98f..39d7a0d99e 100644--- a/packages/lambda/src/cli/commands/functions/rm.ts+++ b/packages/lambda/src/cli/commands/functions/rm.ts@@ -35,8 +35,8 @@ export const functionsRmCommand = async (args: string[]) => {infoOutput.update(['Function name: '.padEnd(LEFT_COL, ' ') + ' ' + info.functionName,- 'Memory: '.padEnd(LEFT_COL, ' ') + ' ' + info.memorySize + 'MB',- 'Timeout: '.padEnd(LEFT_COL, ' ') + ' ' + info.timeout + 'sec',+ 'Memory: '.padEnd(LEFT_COL, ' ') + ' ' + info.memorySizeInMb + 'MB',+ 'Timeout: '.padEnd(LEFT_COL, ' ') + ' ' + info.timeoutInSeconds + 'sec','Version: '.padEnd(LEFT_COL, ' ') + ' ' + info.version,].join('\n'));