Skip to content

🎥 Make videos programmatically with React

on lambda, progress percentage should always be a number

Jonny Burgerb294888ea470
diff --git a/packages/lambda/src/functions/helpers/read-with-progress.ts b/packages/lambda/src/functions/helpers/read-with-progress.ts
index bb38566058..096013a18c 100644
--- a/packages/lambda/src/functions/helpers/read-with-progress.ts
+++ b/packages/lambda/src/functions/helpers/read-with-progress.ts
@@ -5,9 +5,9 @@ import type {AwsRegion} from '../../pricing/aws-regions';
import {getS3Client} from '../../shared/aws-clients';
export type LambdaReadFileProgress = (progress: {
- totalSize: number | null;
+ totalSize: number;
downloaded: number;
- percent: number | null;
+ percent: number;
}) => unknown;
export const lambdaDownloadFileWithProgress = async ({
@@ -36,7 +36,14 @@ export const lambdaDownloadFileWithProgress = async ({
const {to, sizeInBytes} = await RenderInternals.downloadFile({
url: presigned,
- onProgress,
+ onProgress: ({downloaded, percent, totalSize}) => {
+ // On Lambda, it should always be a number
+ onProgress({
+ downloaded,
+ percent: percent as number,
+ totalSize: totalSize as number,
+ });
+ },
to: () => outputPath,
});