Skip to content

🎥 Make videos programmatically with React

remove getFunctionVersion API

Jonny Burger6f47795d2310
diff --git a/packages/docs/docs/deployfunction.md b/packages/docs/docs/deployfunction.md
index 709cb69b04..2a5b564be0 100644
--- a/packages/docs/docs/deployfunction.md
+++ b/packages/docs/docs/deployfunction.md
@@ -10,10 +10,11 @@ Before calling `deployFunction()`, you need to deploy the necessary binaries and
## Example
-```ts
-import {deployFunction, ensureLambdaBinaries} from '@remotion/lambda';
+```ts twoslash
+// @module: esnext
+// @target: es2017
-// ...
+import {deployFunction, ensureLambdaBinaries} from '@remotion/lambda';
const {layerArn} = await ensureLambdaBinaries('us-east-1');
const {functionName} = await deployFunction({
diff --git a/packages/docs/docs/deployproject.md b/packages/docs/docs/deployproject.md
index cfba9a0378..0bb6b68cfa 100644
--- a/packages/docs/docs/deployproject.md
+++ b/packages/docs/docs/deployproject.md
@@ -12,11 +12,11 @@ Before calling this function, you should create a bucket, see [`getOrCreateBucke
## Example
-```ts
+```ts twoslash
+// @module: esnext
+// @target: es2017
import {deployProject} from '@remotion/lambda';
-// ...
-
const {url} = await deployProject({
entryPoint: '/Users/jonnyburger/my-remotion-video/src/index.tsx',
bucketName: 'remotionlambda-c7fsl3d',
diff --git a/packages/docs/docs/getfunctionversion.md b/packages/docs/docs/getfunctionversion.md
deleted file mode 100644
index 5a51172e0f..0000000000
--- a/packages/docs/docs/getfunctionversion.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-id: getfunctionversion
-title: getFunctionVersion()
-slug: /lambda/getfunctionversion
----
diff --git a/packages/docs/docs/lambda-changelog.md b/packages/docs/docs/lambda-changelog.md
index 7af70898f1..0d4a4c60ab 100644
--- a/packages/docs/docs/lambda-changelog.md
+++ b/packages/docs/docs/lambda-changelog.md
@@ -17,6 +17,7 @@ Keep track of changes to the APIs of Remotion Lambda here.
## Unreleased
- `getDeployedLambdas()` was renamed to `getFunctions()`
+- `getFunctionVersion()` was removed, use `getFunctionInfo()`
## July 14th, 2021
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index e2413d9c28..28eba640d4 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -21,7 +21,6 @@ module.exports = {
"deployfunction",
"deletefunction",
"getfunctioninfo",
- "getfunctionversion",
"getfunctions",
"deployproject",
"ensurelambdabinaries",
diff --git a/packages/lambda/src/api/deploy-project.ts b/packages/lambda/src/api/deploy-project.ts
index e0c614995c..fb4066fd61 100644
--- a/packages/lambda/src/api/deploy-project.ts
+++ b/packages/lambda/src/api/deploy-project.ts
@@ -7,12 +7,7 @@ import {makeS3Url} from '../shared/make-s3-url';
import {randomHash} from '../shared/random-hash';
import {uploadDir, UploadDirProgress} from './upload-dir';
-export const deployProject = async ({
- bucketName,
- entryPoint,
- options,
- region,
-}: {
+type DeployProjectInput = {
entryPoint: string;
bucketName: string;
region: AwsRegion;
@@ -21,7 +16,18 @@ export const deployProject = async ({
onWebsiteActivated?: () => void;
onUploadProgress?: (upload: UploadDirProgress) => void;
};
-}) => {
+};
+
+/**
+ * @description Deploys a Remotion project to an S3 bucket to prepare it for rendering on AWS Lambda.
+ * @link https://remotion.dev/docs/lambda/deployproject
+ */
+export const deployProject = async ({
+ bucketName,
+ entryPoint,
+ options,
+ region,
+}: DeployProjectInput) => {
if (!bucketName.startsWith(REMOTION_BUCKET_PREFIX)) {
throw new Error(
`The bucketName parameter must start with ${REMOTION_BUCKET_PREFIX}.`
diff --git a/packages/lambda/src/api/get-function-info.ts b/packages/lambda/src/api/get-function-info.ts
index af3daac30b..dd9bccdedc 100644
--- a/packages/lambda/src/api/get-function-info.ts
+++ b/packages/lambda/src/api/get-function-info.ts
@@ -2,8 +2,8 @@ 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 {getFunctionVersion} from '../shared/get-function-version';
import {validateAwsRegion} from '../shared/validate-aws-region';
-import {getFunctionVersion} from './get-function-version';
type FunctionInfo = {
functionName: string;
diff --git a/packages/lambda/src/api/get-deployed-lambdas.ts b/packages/lambda/src/api/get-functions.ts
similarity index 93%
rename from packages/lambda/src/api/get-deployed-lambdas.ts
rename to packages/lambda/src/api/get-functions.ts
index b1fe269a5f..0ffab1eaf7 100644
--- a/packages/lambda/src/api/get-deployed-lambdas.ts
+++ b/packages/lambda/src/api/get-functions.ts
@@ -2,7 +2,7 @@ import {ListFunctionsCommand} from '@aws-sdk/client-lambda';
import {AwsRegion} from '../pricing/aws-regions';
import {getLambdaClient} from '../shared/aws-clients';
import {RENDER_FN_PREFIX} from '../shared/constants';
-import {getFunctionVersion} from './get-function-version';
+import {getFunctionVersion} from '../shared/get-function-version';
export const getFunctions = async (options: {region: AwsRegion}) => {
const lambdas = await getLambdaClient(options.region).send(
diff --git a/packages/lambda/src/cli/commands/functions/ls.ts b/packages/lambda/src/cli/commands/functions/ls.ts
index 363286f76f..60d1f0b3f0 100644
--- a/packages/lambda/src/cli/commands/functions/ls.ts
+++ b/packages/lambda/src/cli/commands/functions/ls.ts
@@ -1,7 +1,6 @@
import {CliInternals} from '@remotion/cli';
import {Log} from '@remotion/cli/dist/log';
-import {getFunctions} from '../../../api/get-deployed-lambdas';
-import {getFunctionVersion} from '../../../api/get-function-version';
+import {getFunctions} from '../../../api/get-functions';
import {parsedLambdaCli} from '../../args';
import {getAwsRegion} from '../../get-aws-region';
@@ -31,14 +30,6 @@ export const functionsLsCommand = async () => {
fetchingOutput.update('Getting function info...');
- const configs = await Promise.all(
- functions.map((fn) => {
- return getFunctionVersion({
- functionName: fn.name,
- region,
- });
- })
- );
const pluralized = functions.length === 1 ? 'function' : 'functions';
fetchingOutput.update(
`${functions.length} ${pluralized} in the ${region} region`
@@ -54,20 +45,14 @@ export const functionsLsCommand = async () => {
].join('')
)
);
- const info = functions.map((f, i) => {
- return {
- fn: f,
- config: configs[i],
- };
- });
- for (const datapoint of info) {
+ for (const datapoint of functions) {
Log.info(
[
- datapoint.fn.name.padEnd(NAME_COLS, ' '),
- datapoint.config.padEnd(VERSION_COLS, ' '),
- String(datapoint.fn.memory).padEnd(MEMORY_COLS, ' '),
- String(datapoint.fn.timeout).padEnd(TIMEOUT_COLS, ' '),
+ datapoint.name.padEnd(NAME_COLS, ' '),
+ datapoint.version.padEnd(VERSION_COLS, ' '),
+ String(datapoint.memory).padEnd(MEMORY_COLS, ' '),
+ String(datapoint.timeout).padEnd(TIMEOUT_COLS, ' '),
].join('')
);
}
diff --git a/packages/lambda/src/cli/render.ts b/packages/lambda/src/cli/render.ts
index 5386a9afc4..c8339676fb 100644
--- a/packages/lambda/src/cli/render.ts
+++ b/packages/lambda/src/cli/render.ts
@@ -1,5 +1,5 @@
import {CliInternals} from '@remotion/cli';
-import {getFunctions} from '../api/get-deployed-lambdas';
+import {getFunctions} from '../api/get-functions';
import {getRenderProgress} from '../api/get-render-progress';
import {renderVideoOnLambda} from '../api/render-video-on-lambda';
import {BINARY_NAME, CURRENT_VERSION} from '../shared/constants';
diff --git a/packages/lambda/src/index.ts b/packages/lambda/src/index.ts
index d3bbdae323..f40dc656aa 100644
--- a/packages/lambda/src/index.ts
+++ b/packages/lambda/src/index.ts
@@ -2,9 +2,8 @@ import {deleteFunction} from './api/delete-function';
import {deployFunction} from './api/deploy-function';
import {deployProject} from './api/deploy-project';
import {ensureLambdaBinaries} from './api/ensure-lambda-binaries';
-import {getFunctions} from './api/get-deployed-lambdas';
import {getFunctionInfo} from './api/get-function-info';
-import {getFunctionVersion} from './api/get-function-version';
+import {getFunctions} from './api/get-functions';
import {getOrCreateBucket} from './api/get-or-create-bucket';
import {getRenderProgress} from './api/get-render-progress';
import {simulatePermissions} from './api/iam-validation/simulate';
@@ -29,7 +28,6 @@ export {
simulatePermissions,
deleteFunction,
getFunctionInfo,
- getFunctionVersion,
LambdaInternals,
};
export type {AwsRegion};
diff --git a/packages/lambda/src/api/get-function-version.ts b/packages/lambda/src/shared/get-function-version.ts
similarity index 78%
rename from packages/lambda/src/api/get-function-version.ts
rename to packages/lambda/src/shared/get-function-version.ts
index c04f7b3a92..c47d1c19fe 100644
--- a/packages/lambda/src/api/get-function-version.ts
+++ b/packages/lambda/src/shared/get-function-version.ts
@@ -1,10 +1,6 @@
import {AwsRegion} from '../pricing/aws-regions';
-import {callLambda} from '../shared/call-lambda';
-import {
- COMMAND_NOT_FOUND,
- LambdaRoutines,
- LambdaVersions,
-} from '../shared/constants';
+import {callLambda} from './call-lambda';
+import {COMMAND_NOT_FOUND, LambdaRoutines, LambdaVersions} from './constants';
export const getFunctionVersion = async ({
functionName,