Skip to content

🎥 Make videos programmatically with React

compress

Jonny Burger76fbc25ce59d
diff --git a/packages/lambda/src/functions/compositions.ts b/packages/lambda/src/functions/compositions.ts
index 7ebb029bcb..8158a2b1e6 100644
--- a/packages/lambda/src/functions/compositions.ts
+++ b/packages/lambda/src/functions/compositions.ts
@@ -46,7 +46,7 @@ export const compositionsHandler = async (
),
]);
- const inputProps = await decompressInputProps({
+ const serializedInputPropsWithCustomSchema = await decompressInputProps({
bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region: getCurrentRegionInFunction(),
@@ -63,7 +63,7 @@ export const compositionsHandler = async (
const compositions = await RenderInternals.internalGetCompositions({
serveUrlOrWebpackUrl: realServeUrl,
puppeteerInstance: browserInstance,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
+ serializedInputPropsWithCustomSchema,
envVariables: lambdaParams.envVariables ?? {},
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
chromiumOptions: lambdaParams.chromiumOptions,
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 2301240676..6079f8d22d 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -174,13 +174,16 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
propsType: 'input-props',
});
- const inputProps = await inputPropsPromise;
- RenderInternals.Log.info('Validating composition, input props:', inputProps);
+ const serializedInputPropsWithCustomSchema = await inputPropsPromise;
+ RenderInternals.Log.info(
+ 'Validating composition, input props:',
+ serializedInputPropsWithCustomSchema
+ );
const comp = await validateComposition({
serveUrl: params.serveUrl,
composition: params.composition,
browserInstance,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
+ serializedInputPropsWithCustomSchema,
envVariables: params.envVariables ?? {},
timeoutInMilliseconds: params.timeoutInMilliseconds,
chromiumOptions: params.chromiumOptions,
diff --git a/packages/lambda/src/functions/renderer.ts b/packages/lambda/src/functions/renderer.ts
index af908bbe19..c52beefee2 100644
--- a/packages/lambda/src/functions/renderer.ts
+++ b/packages/lambda/src/functions/renderer.ts
@@ -134,7 +134,7 @@ const renderHandler = async (
defaultProps,
},
imageFormat: params.imageFormat,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
+ serializedInputPropsWithCustomSchema: inputProps,
frameRange: params.frameRange,
onProgress: ({renderedFrames, encodedFrames, stitchStage}) => {
if (
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index 8445019903..5b1f78ae6e 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -89,7 +89,7 @@ const innerStillHandler = async (
const outputPath = path.join(outputDir, 'output');
const region = getCurrentRegionInFunction();
- const inputProps = await decompressInputProps({
+ const serializedInputPropsWithCustomSchema = await decompressInputProps({
bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region,
@@ -116,7 +116,7 @@ const innerStillHandler = async (
serveUrl,
browserInstance,
composition: lambdaParams.composition,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
+ serializedInputPropsWithCustomSchema,
envVariables: lambdaParams.envVariables ?? {},
chromiumOptions: lambdaParams.chromiumOptions,
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
diff --git a/packages/lambda/src/shared/compress-props.ts b/packages/lambda/src/shared/compress-props.ts
index fee004e3aa..87e12ab5d3 100644
--- a/packages/lambda/src/shared/compress-props.ts
+++ b/packages/lambda/src/shared/compress-props.ts
@@ -100,9 +100,9 @@ export const decompressInputProps = async ({
bucketName: string;
expectedBucketOwner: string;
propsType: PropsType;
-}): Promise<Record<string, unknown>> => {
+}): Promise<string> => {
if (serialized.type === 'payload') {
- return JSON.parse(serialized.payload);
+ return serialized.payload;
}
try {