🎥 Make videos programmatically with React
remotion lambda version is the same version as the remotion one
Jonny Burger0e07846da8b1
diff --git a/packages/core/ensure-correct-version.js b/packages/core/ensure-correct-version.jsindex 422e87d0f9..572e74be47 100644--- a/packages/core/ensure-correct-version.js+++ b/packages/core/ensure-correct-version.js@@ -21,4 +21,4 @@ if (!distFile.includes(version)) {process.exit(1);}-console.log('Updated version to v3.2.5');+console.log('Updated version to v' + version);diff --git a/packages/lambda/src/admin/make-layer-public.ts b/packages/lambda/src/admin/make-layer-public.tsindex c066822456..97af836023 100644--- a/packages/lambda/src/admin/make-layer-public.ts+++ b/packages/lambda/src/admin/make-layer-public.ts@@ -3,10 +3,10 @@ import {PublishLayerVersionCommand,} from '@aws-sdk/client-lambda';import {lambda} from 'aws-policies';+import {Internals} from 'remotion';import {getRegions} from '..';import {quit} from '../cli/helpers/quit';import {getLambdaClient} from '../shared/aws-clients';-import {CURRENT_VERSION} from '../shared/constants';import type {HostedLayers} from '../shared/hosted-layers';import type {LambdaArchitecture} from '../shared/validate-architecture';@@ -61,7 +61,7 @@ const makeLayerPublic = async () => {? 'Compiled from FFMPEG source. Read FFMPEG license: https://ffmpeg.org/legal.html': 'Contains Noto Sans font. Read Noto Sans License: https://fonts.google.com/noto/specimen/Noto+Sans/about',CompatibleRuntimes: runtimes,- Description: CURRENT_VERSION,+ Description: Internals.VERSION,}));await getLambdaClient(region).send(diff --git a/packages/lambda/src/api/deploy-function.ts b/packages/lambda/src/api/deploy-function.tsindex 43770e2cc1..ad17684c35 100644--- a/packages/lambda/src/api/deploy-function.ts+++ b/packages/lambda/src/api/deploy-function.ts@@ -1,18 +1,15 @@+import {Internals} from 'remotion';import {getFunctions} from '../api/get-functions';import type {AwsRegion} from '../pricing/aws-regions';import {- CURRENT_VERSION,DEFAULT_CLOUDWATCH_RETENTION_PERIOD,DEFAULT_EPHEMERAL_STORAGE_IN_MB,RENDER_FN_PREFIX,} from '../shared/constants';import {FUNCTION_ZIP} from '../shared/function-zip-path';import {getAccountId} from '../shared/get-account-id';-import type {- LambdaArchitecture} from '../shared/validate-architecture';-import {- validateArchitecture,-} from '../shared/validate-architecture';+import type {LambdaArchitecture} from '../shared/validate-architecture';+import {validateArchitecture} from '../shared/validate-architecture';import {validateAwsRegion} from '../shared/validate-aws-region';import {validateCustomRoleArn} from '../shared/validate-custom-role-arn';import {validateDiskSizeInMb} from '../shared/validate-disk-size-in-mb';@@ -63,7 +60,7 @@ export const deployFunction = async (validateCustomRoleArn(options.customRoleArn);const fnNameRender = [- `${RENDER_FN_PREFIX}${CURRENT_VERSION}`,+ `${RENDER_FN_PREFIX}${Internals.VERSION.replace(/\./g, '-')}`,`mem${options.memorySizeInMb}mb`,`disk${diskSizeInMb}mb`,`${options.timeoutInSeconds}sec`,@@ -77,7 +74,7 @@ export const deployFunction = async (const alreadyDeployed = fns.find((f) =>- f.version === CURRENT_VERSION &&+ f.version === Internals.VERSION &&f.memorySizeInMb === options.memorySizeInMb &&f.timeoutInSeconds === options.timeoutInSeconds &&f.diskSizeInMb === diskSizeInMbdiff --git a/packages/lambda/src/api/get-function-info.ts b/packages/lambda/src/api/get-function-info.tsindex 590dd9d399..8f72780727 100644--- a/packages/lambda/src/api/get-function-info.ts+++ b/packages/lambda/src/api/get-function-info.ts@@ -1,11 +1,7 @@import {GetFunctionCommand} from '@aws-sdk/client-lambda';import type {AwsRegion} from '../pricing/aws-regions';import {getLambdaClient} from '../shared/aws-clients';-import type {- LambdaVersions} from '../shared/constants';-import {- DEFAULT_EPHEMERAL_STORAGE_IN_MB-} from '../shared/constants';+import {DEFAULT_EPHEMERAL_STORAGE_IN_MB} from '../shared/constants';import {getFunctionVersion} from '../shared/get-function-version';import {validateAwsRegion} from '../shared/validate-aws-region';@@ -13,7 +9,7 @@ export type FunctionInfo = {functionName: string;timeoutInSeconds: number;memorySizeInMb: number;- version: LambdaVersions | null;+ version: string | null;diskSizeInMb: number;};diff --git a/packages/lambda/src/api/get-functions.ts b/packages/lambda/src/api/get-functions.tsindex 806eb062a9..95c40569b6 100644--- a/packages/lambda/src/api/get-functions.ts+++ b/packages/lambda/src/api/get-functions.ts@@ -1,12 +1,9 @@-import type {- FunctionConfiguration} from '@aws-sdk/client-lambda';-import {- ListFunctionsCommand,-} from '@aws-sdk/client-lambda';+import type {FunctionConfiguration} from '@aws-sdk/client-lambda';+import {ListFunctionsCommand} from '@aws-sdk/client-lambda';+import {Internals} from 'remotion';import type {AwsRegion} from '../pricing/aws-regions';import {getLambdaClient} from '../shared/aws-clients';import {- CURRENT_VERSION,DEFAULT_EPHEMERAL_STORAGE_IN_MB,RENDER_FN_PREFIX,} from '../shared/constants';@@ -107,6 +104,6 @@ export const getFunctions = async (return true;}- return l.version === CURRENT_VERSION;+ return l.version === Internals.VERSION;});};diff --git a/packages/lambda/src/api/mock-functions.ts b/packages/lambda/src/api/mock-functions.tsindex 1890d6be99..2416b87f4e 100644--- a/packages/lambda/src/api/mock-functions.ts+++ b/packages/lambda/src/api/mock-functions.ts@@ -1,17 +1,16 @@import type {AwsRegion} from '../pricing/aws-regions';-import type {LambdaVersions} from '../shared/constants';import type {FunctionInfo} from './get-function-info';export let mockFunctionsStore: (FunctionInfo & {region: AwsRegion;- version: LambdaVersions;+ version: string;})[] = [];export const addFunction = (fn: FunctionInfo, region: AwsRegion) => {mockFunctionsStore.push({...fn,region,- version: fn.version as LambdaVersions,+ version: fn.version as string,});};@@ -27,10 +26,7 @@ export const findFunction = (name: string, region: string) => {);};-export const getAllMockFunctions = (- region: string,- version: LambdaVersions | null-) => {+export const getAllMockFunctions = (region: string, version: string | null) => {return mockFunctionsStore.filter((f) => f.region === region && (version ? f.version === version : true));diff --git a/packages/lambda/src/cli/commands/functions/deploy.ts b/packages/lambda/src/cli/commands/functions/deploy.tsindex c7168f01fd..67fdb58d37 100644--- a/packages/lambda/src/cli/commands/functions/deploy.ts+++ b/packages/lambda/src/cli/commands/functions/deploy.ts@@ -1,8 +1,8 @@import {CliInternals} from '@remotion/cli';import {Log} from '@remotion/cli/dist/log';+import {Internals} from 'remotion';import {deployFunction} from '../../../api/deploy-function';import {- CURRENT_VERSION,DEFAULT_ARCHITECTURE,DEFAULT_CLOUDWATCH_RETENTION_PERIOD,DEFAULT_EPHEMERAL_STORAGE_IN_MB,@@ -43,7 +43,7 @@ Region = ${region}Memory = ${memorySizeInMb}MBDisk size = ${diskSizeInMb}MBTimeout = ${timeoutInSeconds}sec-Version = ${CURRENT_VERSION}+Version = ${Internals.VERSION}Architecture = ${architecture}CloudWatch Logging Enabled = ${createCloudWatchLogGroup}CloudWatch Retention Period = ${cloudWatchLogRetentionPeriodInDays} daysdiff --git a/packages/lambda/src/cli/helpers/find-function-name.ts b/packages/lambda/src/cli/helpers/find-function-name.tsindex 43757048e5..cda703eb89 100644--- a/packages/lambda/src/cli/helpers/find-function-name.ts+++ b/packages/lambda/src/cli/helpers/find-function-name.ts@@ -1,5 +1,6 @@+import {Internals} from 'remotion';import {getFunctions} from '../../api/get-functions';-import {BINARY_NAME, CURRENT_VERSION} from '../../shared/constants';+import {BINARY_NAME} from '../../shared/constants';import {FUNCTIONS_COMMAND} from '../commands/functions';import {FUNCTIONS_DEPLOY_SUBCOMMAND} from '../commands/functions/deploy';import {FUNCTIONS_LS_SUBCOMMAND} from '../commands/functions/ls';@@ -14,12 +15,12 @@ export const findFunctionName = async () => {compatibleOnly: false,});const lambdasWithMatchingVersion = remotionLambdas.filter(- (l) => l.version === CURRENT_VERSION+ (l) => l.version === Internals.VERSION);if (lambdasWithMatchingVersion.length === 0) {Log.error(- `No lambda functions with version ${CURRENT_VERSION} found in your account.`+ `No lambda functions with version ${Internals.VERSION} found in your account.`);if (remotionLambdas.length > 0) {Log.error(diff --git a/packages/lambda/src/functions/chunk-optimization/can-use-optimization.ts b/packages/lambda/src/functions/chunk-optimization/can-use-optimization.tsindex cffc01084a..5189910da2 100644--- a/packages/lambda/src/functions/chunk-optimization/can-use-optimization.ts+++ b/packages/lambda/src/functions/chunk-optimization/can-use-optimization.ts@@ -1,4 +1,4 @@-import {CURRENT_VERSION} from '../../defaults';+import {Internals} from 'remotion';import type {OptimizationProfile} from './types';export const canUseOptimization = ({@@ -18,7 +18,7 @@ export const canUseOptimization = ({return false;}- if (optimization.lambdaVersion !== CURRENT_VERSION) {+ if (optimization.lambdaVersion !== Internals.VERSION) {return false;}diff --git a/packages/lambda/src/functions/chunk-optimization/types.ts b/packages/lambda/src/functions/chunk-optimization/types.tsindex f724541b1e..f397f65131 100644--- a/packages/lambda/src/functions/chunk-optimization/types.ts+++ b/packages/lambda/src/functions/chunk-optimization/types.ts@@ -1,5 +1,3 @@-import type {LambdaVersions} from '../../shared/constants';-export type ObjectChunkTimingData = {chunk: number;frameRange: [number, number];@@ -22,6 +20,6 @@ export type OptimizationProfile = {newTiming: number;createdFromRenderId: string;framesPerLambda: number;- lambdaVersion: LambdaVersions;+ lambdaVersion: string;everyNthFrame: number;};diff --git a/packages/lambda/src/functions/info.ts b/packages/lambda/src/functions/info.tsindex a37478a444..9d37b22479 100644--- a/packages/lambda/src/functions/info.ts+++ b/packages/lambda/src/functions/info.ts@@ -1,10 +1,6 @@-import type {- LambdaPayload,- LambdaVersions} from '../shared/constants';-import {- CURRENT_VERSION,- LambdaRoutines-} from '../shared/constants';+import {Internals} from 'remotion';+import type {LambdaPayload} from '../shared/constants';+import {LambdaRoutines} from '../shared/constants';export const infoHandler = (lambdaParams: LambdaPayload) => {if (lambdaParams.type !== LambdaRoutines.info) {@@ -12,9 +8,9 @@ export const infoHandler = (lambdaParams: LambdaPayload) => {}const returnValue: {- version: LambdaVersions;+ version: string;} = {- version: CURRENT_VERSION,+ version: Internals.VERSION,};return Promise.resolve(returnValue);diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.tsindex e2f6c7e582..a59aa97749 100644--- a/packages/lambda/src/functions/launch.ts+++ b/packages/lambda/src/functions/launch.ts@@ -9,7 +9,6 @@ import type {RenderMetadata,} from '../shared/constants';import {- CURRENT_VERSION,encodingProgressKey,LambdaRoutines,MAX_FUNCTIONS_PER_RENDER,@@ -230,7 +229,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {type: 'video',imageFormat: params.imageFormat,inputProps: params.inputProps,- lambdaVersion: CURRENT_VERSION,+ lambdaVersion: Internals.VERSION,framesPerLambda,memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),region: getCurrentRegionInFunction(),@@ -374,7 +373,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {newTiming: getProfileDuration(optimizedProfile),createdFromRenderId: params.renderId,framesPerLambda,- lambdaVersion: CURRENT_VERSION,+ lambdaVersion: Internals.VERSION,frameRange: realFrameRange,everyNthFrame: params.everyNthFrame,},diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.tsindex 54b88bfaaa..750f9ec6b2 100644--- a/packages/lambda/src/functions/still.ts+++ b/packages/lambda/src/functions/still.ts@@ -3,6 +3,7 @@ import type {StillImageFormat} from '@remotion/renderer';import {RenderInternals, renderStill} from '@remotion/renderer';import fs from 'fs';import path from 'path';+import {Internals} from 'remotion';import {estimatePrice} from '../api/estimate-price';import {getOrCreateBucket} from '../api/get-or-create-bucket';import {getLambdaClient} from '../shared/aws-clients';@@ -12,7 +13,6 @@ import type {RenderMetadata,} from '../shared/constants';import {- CURRENT_VERSION,LambdaRoutines,MAX_EPHEMERAL_STORAGE_IN_MB,renderMetadataKey,@@ -96,7 +96,7 @@ const innerStillHandler = async (usesOptimizationProfile: false,imageFormat: lambdaParams.imageFormat,inputProps: lambdaParams.inputProps,- lambdaVersion: CURRENT_VERSION,+ lambdaVersion: Internals.VERSION,framesPerLambda: 1,memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),region: getCurrentRegionInFunction(),diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.tsindex 7ded29157d..f790924dd2 100644--- a/packages/lambda/src/shared/constants.ts+++ b/packages/lambda/src/shared/constants.ts@@ -312,16 +312,12 @@ export type RenderMetadata = {inputProps: unknown;framesPerLambda: number;memorySizeInMb: number;- lambdaVersion: LambdaVersions;+ lambdaVersion: string;region: AwsRegion;renderId: string;outName: OutNameInput | undefined;};-export type LambdaVersions = '2022-08-16' | 'n/a';--export const CURRENT_VERSION: LambdaVersions = '2022-08-16';-export type PostRenderData = {cost: {estimatedCost: number;diff --git a/packages/lambda/src/shared/get-function-version.ts b/packages/lambda/src/shared/get-function-version.tsindex 5996175a71..2c4f2ff34e 100644--- a/packages/lambda/src/shared/get-function-version.ts+++ b/packages/lambda/src/shared/get-function-version.ts@@ -1,6 +1,5 @@import type {AwsRegion} from '../pricing/aws-regions';import {callLambda} from './call-lambda';-import type { LambdaVersions} from './constants';import {COMMAND_NOT_FOUND, LambdaRoutines} from './constants';export const getFunctionVersion = async ({@@ -9,7 +8,7 @@ export const getFunctionVersion = async ({}: {functionName: string;region: AwsRegion;-}): Promise<LambdaVersions> => {+}): Promise<string> => {try {const result = await callLambda({functionName,diff --git a/packages/lambda/src/test/integration/cli.test.ts b/packages/lambda/src/test/integration/cli.test.tsindex bc1f3c17b0..e1a9758a05 100644--- a/packages/lambda/src/test/integration/cli.test.ts+++ b/packages/lambda/src/test/integration/cli.test.ts@@ -1,7 +1,7 @@// eslint-disable-next-line no-restricted-importsimport {CliInternals} from '@remotion/cli';+import {Internals} from 'remotion';import {- CURRENT_VERSION,DEFAULT_EPHEMERAL_STORAGE_IN_MB,DEFAULT_MEMORY_SIZE,DEFAULT_TIMEOUT,@@ -12,7 +12,10 @@ import {getProcessWriteOutput} from './console-hooks';test('Deploy function', async () => {await LambdaInternals.executeCommand(['functions', 'deploy']);expect(getProcessWriteOutput()).toContain(- `Deployed as remotion-render-${CURRENT_VERSION}-mem${DEFAULT_MEMORY_SIZE}mb-disk${DEFAULT_EPHEMERAL_STORAGE_IN_MB}mb-${DEFAULT_TIMEOUT}sec\n`+ `Deployed as remotion-render-${Internals.VERSION.replace(+ /\./g,+ '-'+ )}-mem${DEFAULT_MEMORY_SIZE}mb-disk${DEFAULT_EPHEMERAL_STORAGE_IN_MB}mb-${DEFAULT_TIMEOUT}sec\n`);});diff --git a/packages/lambda/src/test/integration/deploy-function.test.ts b/packages/lambda/src/test/integration/deploy-function.test.tsindex e322e774d3..b966d09683 100644--- a/packages/lambda/src/test/integration/deploy-function.test.ts+++ b/packages/lambda/src/test/integration/deploy-function.test.ts@@ -1,3 +1,4 @@+import {Internals} from 'remotion';import {deleteFunction} from '../../api/delete-function';import {deployFunction} from '../../api/deploy-function';import {getFunctions} from '../../api/get-functions';@@ -5,13 +6,13 @@ import {cleanFnStore,markFunctionAsIncompatible,} from '../../api/mock-functions';-import {- CURRENT_VERSION,- DEFAULT_EPHEMERAL_STORAGE_IN_MB,-} from '../../shared/constants';+import {DEFAULT_EPHEMERAL_STORAGE_IN_MB} from '../../shared/constants';const expectedFunctionName = (memory: number, timeout: number, disk: number) =>- `remotion-render-${CURRENT_VERSION}-mem${memory}mb-disk${disk}mb-${timeout}sec`;+ `remotion-render-${Internals.VERSION.replace(+ /\./g,+ '-'+ )}-mem${memory}mb-disk${disk}mb-${timeout}sec`;test('Should be able to deploy function', async () => {const {functionName} = await deployFunction({@@ -52,7 +53,7 @@ test('Should be able to get the function afterwards', async () => {),memorySizeInMb: 2048,timeoutInSeconds: 120,- version: CURRENT_VERSION,+ version: Internals.VERSION,region: 'us-east-1',diskSizeInMb: 2048,},@@ -118,7 +119,7 @@ test('Should be able to get the function afterwards', async () => {),memorySizeInMb: 2048,timeoutInSeconds: 120,- version: CURRENT_VERSION,+ version: Internals.VERSION,region: 'us-east-1',diskSizeInMb: 2048,},diff --git a/packages/lambda/src/test/integration/handlers.test.ts b/packages/lambda/src/test/integration/handlers.test.tsindex ec8cd46ddd..d9a12f7698 100644--- a/packages/lambda/src/test/integration/handlers.test.ts+++ b/packages/lambda/src/test/integration/handlers.test.ts@@ -1,4 +1,5 @@-import {CURRENT_VERSION, LambdaRoutines} from '../../defaults';+import {VERSION} from 'remotion/src/version';+import {LambdaRoutines} from '../../defaults';import {handler} from '../../functions/index';test('Call function locally', async () => {@@ -10,5 +11,5 @@ test('Call function locally', async () => {getRemainingTimeInMillis: () => 1000,})- ).toEqual({version: CURRENT_VERSION});+ ).toEqual({version: VERSION});});