Skip to content

🎥 Make videos programmatically with React

version check

Jonny Burger265565d0a0af
diff --git a/packages/lambda/src/functions/compositions.ts b/packages/lambda/src/functions/compositions.ts
index 6b50059dff..587d52dab0 100644
--- a/packages/lambda/src/functions/compositions.ts
+++ b/packages/lambda/src/functions/compositions.ts
@@ -1,3 +1,4 @@
+import {VERSION} from 'remotion/version';
import type {LambdaPayload} from '../defaults';
import {LambdaRoutines} from '../defaults';
@@ -6,5 +7,17 @@ export const compositionsHandler = (lambdaParams: LambdaPayload) => {
throw new TypeError('Expected info compositions');
}
+ if (lambdaParams.version !== VERSION) {
+ if (!lambdaParams.version) {
+ throw new Error(
+ `Version mismatch: When calling getCompositionsOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`
+ );
+ }
+
+ throw new Error(
+ `Version mismatch: When calling getCompositionsOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`
+ );
+ }
+
return Promise.resolve({});
};
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index 0f06687957..ce9db3a3a8 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -54,17 +54,15 @@ const innerStillHandler = async (
}
if (lambdaParams.version !== VERSION) {
- if (lambdaParams.version !== VERSION) {
- if (!lambdaParams.version) {
- throw new Error(
- `Version mismatch: When calling renderMediaOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`
- );
- }
-
+ if (!lambdaParams.version) {
throw new Error(
- `Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`
+ `Version mismatch: When calling renderMediaOnLambda(), you called the function ${process.env.AWS_LAMBDA_FUNCTION_NAME} which has the version ${VERSION} but the @remotion/lambda package is an older version. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`
);
}
+
+ throw new Error(
+ `Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`
+ );
}
validateDownloadBehavior(lambdaParams.downloadBehavior);
diff --git a/packages/lambda/src/shared/constants.ts b/packages/lambda/src/shared/constants.ts
index 476c86d6ae..239a149372 100644
--- a/packages/lambda/src/shared/constants.ts
+++ b/packages/lambda/src/shared/constants.ts
@@ -349,6 +349,7 @@ export type LambdaPayloads = {
};
compositions: {
type: LambdaRoutines.compositions;
+ version: string;
};
};