Skip to content

🎥 Make videos programmatically with React

lambda: rename options to params

Jonny Burgeraf1cdb816956
diff --git a/packages/lambda/src/api/delete-function.ts b/packages/lambda/src/api/delete-function.ts
index b0e3ee9476..7616018940 100644
--- a/packages/lambda/src/api/delete-function.ts
+++ b/packages/lambda/src/api/delete-function.ts
@@ -10,8 +10,8 @@ export type DeleteFunctionInput = {
/**
* @description Deletes a function from AWS Lambda.
* @see [Documentation](https://remotion.dev/docs/lambda/deletefunction)
- * @param options.region The region the function was deployed to.
- * @param options.functionName The name of the function.
+ * @param params.region The region the function was deployed to.
+ * @param params.functionName The name of the function.
* @returns {Promise<void>} Nothing. Throws if the function failed to delete.
*/
export const deleteFunction = async ({
diff --git a/packages/lambda/src/api/delete-site.ts b/packages/lambda/src/api/delete-site.ts
index 845e54d233..2b79d51f32 100644
--- a/packages/lambda/src/api/delete-site.ts
+++ b/packages/lambda/src/api/delete-site.ts
@@ -19,10 +19,10 @@ export type DeleteSiteOutput = {
*
* @description Deletes a deployed site from your S3 bucket. The opposite of deploySite().
* @see [Documentation](https://remotion.dev/docs/lambda/deletesite)
- * @param options.bucketName The S3 bucket name where the site resides in.
- * @param options.siteName The ID of the site that you want to delete.
- * @param {AwsRegion} options.region The region in where the S3 bucket resides in.
- * @param options.onAfterItemDeleted Function that gets called after each file that gets deleted, useful for showing progress.
+ * @param params.bucketName The S3 bucket name where the site resides in.
+ * @param params.siteName The ID of the site that you want to delete.
+ * @param {AwsRegion} params.region The region in where the S3 bucket resides in.
+ * @param params.onAfterItemDeleted Function that gets called after each file that gets deleted, useful for showing progress.
* @returns {Promise<DeleteSiteOutput>} Object containing info about how much space was freed.
*/
export const deleteSite = async ({
diff --git a/packages/lambda/src/api/deploy-function.ts b/packages/lambda/src/api/deploy-function.ts
index eff0b32aa1..de7f579cb2 100644
--- a/packages/lambda/src/api/deploy-function.ts
+++ b/packages/lambda/src/api/deploy-function.ts
@@ -41,67 +41,67 @@ export type DeployFunctionOutput = {
/**
* @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
* @see [Documentation](https://www.remotion.dev/docs/lambda/deployfunction)
- * @param options.createCloudWatchLogGroup Whether you'd like to create a CloudWatch Log Group to store the logs for this function.
- * @param options.cloudWatchLogRetentionPeriodInDays (optional) The number of days to retain the CloudWatch logs for this function. Default is 14 days.
- * @param options.region The region you want to deploy your function to.
- * @param options.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
- * @param options.memorySizeInMb How much memory should be allocated to the Lambda function.
- * @param options.architecture The architecture Lambda should run on. One of x86_64 and x64
- * @param options.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
+ * @param params.createCloudWatchLogGroup Whether you'd like to create a CloudWatch Log Group to store the logs for this function.
+ * @param params.cloudWatchLogRetentionPeriodInDays (optional) The number of days to retain the CloudWatch logs for this function. Default is 14 days.
+ * @param params.region The region you want to deploy your function to.
+ * @param params.timeoutInSeconds After how many seconds the lambda function should be killed if it does not end itself.
+ * @param params.memorySizeInMb How much memory should be allocated to the Lambda function.
+ * @param params.architecture The architecture Lambda should run on. One of x86_64 and x64
+ * @param params.diskSizeInMb The amount of storage the function should be allocated. The higher, the longer videos you can render. Default 512.
* @returns {Promise<DeployFunctionOutput>} An object that contains the `functionName` property
*/
export const deployFunction = async (
- options: DeployFunctionInput
+ params: DeployFunctionInput
): Promise<DeployFunctionOutput> => {
- const diskSizeInMb = options.diskSizeInMb ?? DEFAULT_EPHEMERAL_STORAGE_IN_MB;
+ const diskSizeInMb = params.diskSizeInMb ?? DEFAULT_EPHEMERAL_STORAGE_IN_MB;
- validateMemorySize(options.memorySizeInMb);
- validateTimeout(options.timeoutInSeconds);
- validateAwsRegion(options.region);
- validateCloudWatchRetentionPeriod(options.cloudWatchLogRetentionPeriodInDays);
- validateArchitecture(options.architecture);
+ validateMemorySize(params.memorySizeInMb);
+ validateTimeout(params.timeoutInSeconds);
+ validateAwsRegion(params.region);
+ validateCloudWatchRetentionPeriod(params.cloudWatchLogRetentionPeriodInDays);
+ validateArchitecture(params.architecture);
validateDiskSizeInMb(diskSizeInMb);
- validateCustomRoleArn(options.customRoleArn);
+ validateCustomRoleArn(params.customRoleArn);
const fnNameRender = [
`${RENDER_FN_PREFIX}${LAMBDA_VERSION_STRING}`,
- `mem${options.memorySizeInMb}mb`,
+ `mem${params.memorySizeInMb}mb`,
`disk${diskSizeInMb}mb`,
- `${options.timeoutInSeconds}sec`,
+ `${params.timeoutInSeconds}sec`,
].join('-');
- const accountId = await getAccountId({region: options.region});
+ const accountId = await getAccountId({region: params.region});
const fns = await getFunctions({
compatibleOnly: true,
- region: options.region,
+ region: params.region,
});
const alreadyDeployed = fns.find(
(f) =>
f.version === VERSION &&
- f.memorySizeInMb === options.memorySizeInMb &&
- f.timeoutInSeconds === options.timeoutInSeconds &&
+ f.memorySizeInMb === params.memorySizeInMb &&
+ f.timeoutInSeconds === params.timeoutInSeconds &&
f.diskSizeInMb === diskSizeInMb
);
const created = await createFunction({
- createCloudWatchLogGroup: options.createCloudWatchLogGroup,
- region: options.region,
+ createCloudWatchLogGroup: params.createCloudWatchLogGroup,
+ region: params.region,
zipFile:
- options.architecture === 'arm64'
+ params.architecture === 'arm64'
? FUNCTION_ZIP_ARM64
: FUNCTION_ZIP_X86_64,
functionName: fnNameRender,
accountId,
- memorySizeInMb: options.memorySizeInMb,
- timeoutInSeconds: options.timeoutInSeconds,
+ memorySizeInMb: params.memorySizeInMb,
+ timeoutInSeconds: params.timeoutInSeconds,
retentionInDays:
- options.cloudWatchLogRetentionPeriodInDays ??
+ params.cloudWatchLogRetentionPeriodInDays ??
DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
alreadyCreated: Boolean(alreadyDeployed),
- architecture: options.architecture,
+ architecture: params.architecture,
ephemerealStorageInMb: diskSizeInMb,
- customRoleArn: options.customRoleArn as string,
+ customRoleArn: params.customRoleArn as string,
});
if (!created.FunctionName) {
diff --git a/packages/lambda/src/api/get-functions.ts b/packages/lambda/src/api/get-functions.ts
index 4484956a42..0d2a7e42a7 100644
--- a/packages/lambda/src/api/get-functions.ts
+++ b/packages/lambda/src/api/get-functions.ts
@@ -52,17 +52,17 @@ const getAllFunctions = async ({
/**
* @description Lists Remotion Lambda render functions deployed to AWS Lambda.
* @see [Documentation](https://remotion.dev/docs/lambda/getfunctions)
- * @param options.region The region of which the functions should be listed.
- * @param options.compatibleOnly Whether only functions compatible with the installed version of Remotion Lambda should be returned.
+ * @param params.region The region of which the functions should be listed.
+ * @param params.compatibleOnly Whether only functions compatible with the installed version of Remotion Lambda should be returned.
* @returns {Promise<FunctionInfo[]>} An array with the objects containing information about the deployed functions.
*/
export const getFunctions = async (
- options: GetFunctionsInput
+ params: GetFunctionsInput
): Promise<FunctionInfo[]> => {
const lambdas = await getAllFunctions({
existing: [],
nextMarker: null,
- region: options.region,
+ region: params.region,
});
const remotionLambdas = lambdas.filter((f) => {
@@ -74,7 +74,7 @@ export const getFunctions = async (
try {
const version = await getFunctionVersion({
functionName: fn.FunctionName as string,
- region: options.region,
+ region: params.region,
});
return version;
} catch (err) {
@@ -93,12 +93,12 @@ export const getFunctions = async (
lambda.EphemeralStorage?.Size ?? DEFAULT_EPHEMERAL_STORAGE_IN_MB,
};
});
- if (!options.compatibleOnly) {
+ if (!params.compatibleOnly) {
return list;
}
return list.filter((l) => {
- if (!options.compatibleOnly) {
+ if (!params.compatibleOnly) {
return true;
}
diff --git a/packages/lambda/src/api/get-or-create-bucket.ts b/packages/lambda/src/api/get-or-create-bucket.ts
index ef60e5b1e9..5ca5a8c51b 100644
--- a/packages/lambda/src/api/get-or-create-bucket.ts
+++ b/packages/lambda/src/api/get-or-create-bucket.ts
@@ -16,35 +16,35 @@ export type GetOrCreateBucketOutput = {
/**
* @description Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
* @see [Documentation](https://remotion.dev/docs/lambda/getorcreatebucket)
- * @param options.region The region in which you want your S3 bucket to reside in.
+ * @param params.region The region in which you want your S3 bucket to reside in.
* @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
*/
export const getOrCreateBucket = async (
- options: GetOrCreateBucketInput
+ params: GetOrCreateBucketInput
): Promise<GetOrCreateBucketOutput> => {
- const {remotionBuckets} = await getRemotionS3Buckets(options.region);
+ const {remotionBuckets} = await getRemotionS3Buckets(params.region);
if (remotionBuckets.length > 1) {
throw new Error(
`You have multiple buckets (${remotionBuckets.map(
(b) => b.name
)}) in your S3 region (${
- options.region
+ params.region
}) starting with "${REMOTION_BUCKET_PREFIX}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`
);
}
if (remotionBuckets.length === 1) {
- options.onBucketEnsured?.();
+ params.onBucketEnsured?.();
return {bucketName: remotionBuckets[0].name, alreadyExisted: true};
}
- const bucketName = makeBucketName(options.region);
+ const bucketName = makeBucketName(params.region);
await createBucket({
bucketName,
- region: options.region,
+ region: params.region,
});
- options.onBucketEnsured?.();
+ params.onBucketEnsured?.();
return {bucketName, alreadyExisted: false};
};
diff --git a/packages/lambda/src/api/speculate-function-name.ts b/packages/lambda/src/api/speculate-function-name.ts
index 1a52abc9dd..59567de4d5 100644
--- a/packages/lambda/src/api/speculate-function-name.ts
+++ b/packages/lambda/src/api/speculate-function-name.ts
@@ -10,9 +10,9 @@ export type SpeculateFunctionNameInput = {
/**
* @description Speculate the name of a lambda function that will be created when you call `deployFunction`, based on the function configuration.
* @see [Documentation](https://www.remotion.dev/docs/lambda/speculatefunctionname)
- * @param options.memorySizeInMb How much memory is allocated to the Lambda function.
- * @param options.diskSizeInMb The amount of storage the function is allocated.
- * @param options.timeoutInSeconds Time in seconds until the function times out.
+ * @param params.memorySizeInMb How much memory is allocated to the Lambda function.
+ * @param params.diskSizeInMb The amount of storage the function is allocated.
+ * @param params.timeoutInSeconds Time in seconds until the function times out.
* @returns {string} The speculated lambda function name
*/
export const speculateFunctionName = ({