🎥 Make videos programmatically with React
update docs URL
Jonny Burger4116aade7db6
diff --git a/packages/lambda/src/api/delete-function.ts b/packages/lambda/src/api/delete-function.tsindex ae58373100..edd82f3a90 100644--- a/packages/lambda/src/api/delete-function.ts+++ b/packages/lambda/src/api/delete-function.ts@@ -4,7 +4,7 @@ import {getLambdaClient} from '../shared/aws-clients';/*** @description Deletes a function from AWS Lambda.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/deletefunction+ * @link https://remotion-3.vercel.app/docs/lambda/deletefunction* @param options.region The region the function was deployed to.* @param options.functionName The name of the function.* @returns Nothing. Throws if the function failed to delete.diff --git a/packages/lambda/src/api/delete-site.ts b/packages/lambda/src/api/delete-site.tsindex cdd93599e1..70a344a4dc 100644--- a/packages/lambda/src/api/delete-site.ts+++ b/packages/lambda/src/api/delete-site.ts@@ -18,7 +18,7 @@ export type DeleteSiteReturnData = {/**** @description Deletes a deployed site from your S3 bucket. The opposite of deploySite().- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/deletesite+ * @link https://remotion-3.vercel.app/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.diff --git a/packages/lambda/src/api/deploy-function.ts b/packages/lambda/src/api/deploy-function.tsindex 80d9bfefcd..23e590b82e 100644--- a/packages/lambda/src/api/deploy-function.ts+++ b/packages/lambda/src/api/deploy-function.ts@@ -10,7 +10,7 @@ import {createFunction} from './create-function';/*** @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/deployfunction+ * @link https://remotion-3.vercel.app/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.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.diff --git a/packages/lambda/src/api/deploy-site.ts b/packages/lambda/src/api/deploy-site.tsindex 815adf93f6..4683f91df4 100644--- a/packages/lambda/src/api/deploy-site.ts+++ b/packages/lambda/src/api/deploy-site.ts@@ -31,7 +31,7 @@ export type DeploySiteReturnType = Promise<{/*** @description Deploys a Remotion project to an S3 bucket to prepare it for rendering on AWS Lambda.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/deploysite+ * @link https://remotion-3.vercel.app/docs/lambda/deploysite* @param {AwsRegion} params.region The region in which the S3 bucket resides in.* @param {string} params.entryPoint An absolute path to the entry file of your Remotion project.* @param {string} params.bucketName The name of the bucket to deploy your project into.diff --git a/packages/lambda/src/api/enable-s3-website.ts b/packages/lambda/src/api/enable-s3-website.tsindex fc70fefb1a..4751038b35 100644--- a/packages/lambda/src/api/enable-s3-website.ts+++ b/packages/lambda/src/api/enable-s3-website.ts@@ -13,7 +13,6 @@ export const enableS3Website = async ({new PutBucketWebsiteCommand({Bucket: bucketName,WebsiteConfiguration: {- // TODO Upload a demo documentIndexDocument: {Suffix: 'index.html',},diff --git a/packages/lambda/src/api/get-buckets.ts b/packages/lambda/src/api/get-buckets.tsindex 397e38a869..75ba546a88 100644--- a/packages/lambda/src/api/get-buckets.ts+++ b/packages/lambda/src/api/get-buckets.ts@@ -9,7 +9,6 @@ export type BucketWithLocation = {region: AwsRegion;};-// TODO: In the CLI, warn everytime this function gets called about more than 1 bucket.export const getRemotionS3Buckets = async (region: AwsRegion): Promise<{diff --git a/packages/lambda/src/api/get-function-info.ts b/packages/lambda/src/api/get-function-info.tsindex a598cbf714..9455af0c94 100644--- a/packages/lambda/src/api/get-function-info.ts+++ b/packages/lambda/src/api/get-function-info.ts@@ -19,7 +19,7 @@ type GetFunctionInfoArgs = {/*** @description Given a region and function name, returns information about the function such as version, memory size and timeout.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/getfunctioninfo+ * @link https://remotion-3.vercel.app/docs/lambda/getfunctioninfo* @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.diff --git a/packages/lambda/src/api/get-functions.ts b/packages/lambda/src/api/get-functions.tsindex de987f74a0..a705816414 100644--- a/packages/lambda/src/api/get-functions.ts+++ b/packages/lambda/src/api/get-functions.ts@@ -9,7 +9,7 @@ import {FunctionInfo} from './get-function-info';*** @description Lists Remotion Lambda render functions deployed to AWS Lambda.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/getfunctions+ * @link https://remotion-3.vercel.app/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.* @returns An array with the objects containing information about the deployed functions.diff --git a/packages/lambda/src/api/get-render-progress.ts b/packages/lambda/src/api/get-render-progress.tsindex fdfc063247..5bea8933e9 100644--- a/packages/lambda/src/api/get-render-progress.ts+++ b/packages/lambda/src/api/get-render-progress.ts@@ -4,7 +4,7 @@ import {LambdaRoutines} from '../shared/constants';/*** @description Gets the current status of a render originally triggered via renderVideoOnLambda().- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/getrenderprogress+ * @link https://remotion-3.vercel.app/docs/lambda/getrenderprogress* @param {string} params.functionName The name of the function used to trigger the render.* @param {string} params.bucketName The name of the bucket that was used in the render.* @param {string} params.renderId The ID of the render that was returned by `renderVideoOnLambda()`.diff --git a/packages/lambda/src/api/iam-validation/suggested-policy.ts b/packages/lambda/src/api/iam-validation/suggested-policy.tsindex 3690130bd6..56346c91d0 100644--- a/packages/lambda/src/api/iam-validation/suggested-policy.ts+++ b/packages/lambda/src/api/iam-validation/suggested-policy.ts@@ -31,7 +31,7 @@ const suggestedRolePolicy = {/*** @description Returns an inline JSON policy to be assigned to the AWS user whose credentials are being used for excuting CLI commands or calling Node.JS functions.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/getuserpolicy+ * @link https://remotion-3.vercel.app/docs/lambda/getuserpolicy*/export const getUserPolicy = () => JSON.stringify(suggestedPolicy, null, 2);@@ -40,6 +40,6 @@ export const ROLE_NAME = 'remotion-lambda-role';/*** @description Returns an inline JSON policy to be assigned to the 'remotion-lambda-role' role that needs to be created in your AWS account.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/getrolepolicy+ * @link https://remotion-3.vercel.app/docs/lambda/getrolepolicy*/export const getRolePolicy = () => JSON.stringify(suggestedRolePolicy, null, 2);diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.tsindex 4741c33044..24ee74b345 100644--- a/packages/lambda/src/api/render-still-on-lambda.ts+++ b/packages/lambda/src/api/render-still-on-lambda.ts@@ -5,7 +5,7 @@ import {DEFAULT_MAX_RETRIES, LambdaRoutines} from '../shared/constants';import {convertToServeUrl} from '../shared/convert-to-serve-url';/*** @description Renders a still frame on Lambda- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/renderstillonlambda+ * @link https://remotion-3.vercel.app/docs/lambda/renderstillonlambda* @param params.functionName The name of the Lambda function that should be used* @param params.serveUrl The URL of the deployed project* @param params.composition The ID of the composition which should be rendered.diff --git a/packages/lambda/src/api/render-video-on-lambda.ts b/packages/lambda/src/api/render-video-on-lambda.tsindex c05e107695..6e894bcdc5 100644--- a/packages/lambda/src/api/render-video-on-lambda.ts+++ b/packages/lambda/src/api/render-video-on-lambda.ts@@ -14,11 +14,11 @@ import {Privacy,} from '../shared/constants';import {convertToServeUrl} from '../shared/convert-to-serve-url';-import {validateFramesPerLambda} from './validate-frames-per-lambda';+import {validateFramesPerLambda} from '../shared/validate-frames-per-lambda';/*** @description Triggers a render on a lambda given a composition and a lambda function.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/rendervideoonlambda+ * @link https://remotion-3.vercel.app/docs/lambda/rendervideoonlambda* @param params.functionName The name of the Lambda function that should be used* @param params.serveUrl The URL of the deployed project* @param params.composition The ID of the composition which should be rendered.diff --git a/packages/lambda/src/api/validate-frames-per-lambda.ts b/packages/lambda/src/api/validate-frames-per-lambda.tsdeleted file mode 100644index d96b5b9756..0000000000--- a/packages/lambda/src/api/validate-frames-per-lambda.ts+++ /dev/null@@ -1,37 +0,0 @@-import {MINIMUM_FRAMES_PER_LAMBDA} from '../defaults';--export const validateFramesPerLambda = (- framesPerLambda: number | undefined-) => {- if (typeof framesPerLambda === 'undefined') {- return;- }-- if (typeof framesPerLambda !== 'number') {- throw new TypeError(- `"framesPerLambda" must be a number, but is ${typeof framesPerLambda}`- );- }-- if (Number.isNaN(framesPerLambda)) {- throw new TypeError(`"framesPerLambda" must be a real number, but is NaN`);- }-- if (!Number.isFinite(framesPerLambda)) {- throw new TypeError(- `"framesPerLambda" must be a finite number, but is ${framesPerLambda}`- );- }-- if (framesPerLambda % 1 !== 0) {- throw new TypeError(- `"framesPerLambda" must be an integer, but is ${framesPerLambda}`- );- }-- if (framesPerLambda < MINIMUM_FRAMES_PER_LAMBDA) {- throw new TypeError(- `"framesPerLambda" must be at least ${MINIMUM_FRAMES_PER_LAMBDA}, but is ${framesPerLambda}`- );- }-};diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.tsindex 2da3e2615d..d28c1bfb1c 100644--- a/packages/lambda/src/cli/commands/render/render.ts+++ b/packages/lambda/src/cli/commands/render/render.ts@@ -50,8 +50,6 @@ export const renderCommand = async (args: string[]) => {const outName = args[2] ?? null;- // TODO: Further validate serveUrl-const cliOptions = await CliInternals.getCliOptions({type: 'series',isLambda: true,diff --git a/packages/lambda/src/cli/commands/sites/rm.ts b/packages/lambda/src/cli/commands/sites/rm.tsindex c7f988dcfd..38f56e0e3a 100644--- a/packages/lambda/src/cli/commands/sites/rm.ts+++ b/packages/lambda/src/cli/commands/sites/rm.ts@@ -26,8 +26,13 @@ export const sitesRmSubcommand = async (args: string[]) => {const {remotionBuckets} = await getRemotionS3Buckets(region);if (remotionBuckets.length > 1) {+ Log.error('You have more than one Remotion Lambda bucket:');+ for (const bucket of remotionBuckets) {+ Log.error(`- ${bucket.name}`);+ }+Log.error(- 'You have more than one Remotion Lambda bucket. You should only have one - delete all but one before continuing.'+ 'You should only have one - delete all but one before continuing.');quit(1);}diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.tsindex c3ced26460..e2e2ee05c7 100644--- a/packages/lambda/src/functions/launch.ts+++ b/packages/lambda/src/functions/launch.ts@@ -2,7 +2,6 @@ import {InvokeCommand} from '@aws-sdk/client-lambda';import {RenderInternals} from '@remotion/renderer';import fs from 'fs';import {Internals} from 'remotion';-import {validateFramesPerLambda} from '../api/validate-frames-per-lambda';import {getLambdaClient} from '../shared/aws-clients';import {chunk} from '../shared/chunk';import {@@ -17,6 +16,7 @@ import {rendersPrefix,} from '../shared/constants';import {getServeUrlHash} from '../shared/make-s3-url';+import {validateFramesPerLambda} from '../shared/validate-frames-per-lambda';import {validatePrivacy} from '../shared/validate-privacy';import {collectChunkInformation} from './chunk-optimization/collect-data';import {getFrameRangesFromProfile} from './chunk-optimization/get-frame-ranges-from-profile';@@ -91,22 +91,23 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {Internals.validateDimension(comp.height, 'height', 'passed to <Component />');Internals.validateDimension(comp.width, 'width', 'passed to <Component />');- validatePrivacy(params.privacy);-- // TODO: Validate frame range- const {framesPerLambda} = params;-const realFrameRange = RenderInternals.getRealFrameRange(comp.durationInFrames,params.frameRange);const frameCount = realFrameRange[1] - realFrameRange[0] + 1;- const chunkCount = Math.ceil(frameCount / framesPerLambda);+ const chunkCount = Math.ceil(frameCount / params.framesPerLambda);++ if (chunkCount > 200) {+ throw new Error(`Too many functions: A value `);+ }++ validatePrivacy(params.privacy);const {chunks, didUseOptimization} = planFrameRanges({chunkCount,- framesPerLambda,+ framesPerLambda: params.framesPerLambda,optimization,shouldUseOptimization: params.enableChunkOptimization,frameRange: realFrameRange,@@ -300,7 +301,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {oldTiming: getProfileDuration(chunkData),newTiming: getProfileDuration(optimizedProfile),createdFromRenderId: params.renderId,- framesPerLambda,+ framesPerLambda: params.framesPerLambda,lambdaVersion: CURRENT_VERSION,frameRange: realFrameRange,},diff --git a/packages/lambda/src/pricing/calculate-price.ts b/packages/lambda/src/pricing/calculate-price.tsindex 8a7612ae30..9176307f10 100644--- a/packages/lambda/src/pricing/calculate-price.ts+++ b/packages/lambda/src/pricing/calculate-price.ts@@ -11,7 +11,7 @@ type EstimatePriceInput = {/**** @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.- * @link https://remotion-lambda-alpha.netlify.app/docs/lambda/estimateprice+ * @link https://remotion-3.vercel.app/docs/lambda/estimateprice* @returns `number` Price in USD*/export const estimatePrice = ({diff --git a/packages/lambda/src/shared/docs-url.ts b/packages/lambda/src/shared/docs-url.tsindex ae31fe8050..25927cb803 100644--- a/packages/lambda/src/shared/docs-url.ts+++ b/packages/lambda/src/shared/docs-url.ts@@ -1 +1 @@-export const DOCS_URL = 'https://remotion-lambda-alpha.netlify.app';+export const DOCS_URL = 'https://remotion-3.vercel.app';diff --git a/packages/lambda/src/shared/validate-frames-per-lambda.ts b/packages/lambda/src/shared/validate-frames-per-lambda.tsnew file mode 100644index 0000000000..d144e9a0b3--- /dev/null+++ b/packages/lambda/src/shared/validate-frames-per-lambda.ts@@ -0,0 +1,31 @@+export const validateFramesPerLambda = (framesPerLambda: unknown) => {+ if (typeof framesPerLambda !== 'number') {+ throw new TypeError(+ `'framesPerLambda' needs to be a number, passed ${JSON.stringify(+ framesPerLambda+ )}`+ );+ }++ if (!Number.isFinite(framesPerLambda)) {+ throw new TypeError(+ `'framesPerLambda' needs to be finite, passed ${framesPerLambda}`+ );+ }++ if (Number.isNaN(framesPerLambda)) {+ throw new TypeError(+ `'framesPerLambda' needs to be NaN, passed ${framesPerLambda}`+ );+ }++ if (framesPerLambda % 1 !== 0) {+ throw new TypeError(+ `'framesPerLambda' needs to be an integer, passed ${framesPerLambda}`+ );+ }++ if (framesPerLambda < 4) {+ throw new TypeError('The framesPerLambda needs to be at least 4.');+ }+};