Skip to content

🎥 Make videos programmatically with React

pull logs

Jonny Burger301ee633af1d
diff --git a/packages/lambda/src/run.ts b/packages/lambda/src/run.ts
index 011ccc2545..70bf752302 100644
--- a/packages/lambda/src/run.ts
+++ b/packages/lambda/src/run.ts
@@ -1,17 +1,24 @@
import {CliInternals} from '@remotion/cli';
+import {writeFileSync} from 'fs';
import path from 'path';
import {lambdaClient, s3Client} from './aws-clients';
import {callLambda} from './call-lambda';
import {checkLambdaStatus} from './check-lambda-status';
import {cleanupLambdas, getRemotionLambdas} from './cleanup/cleanup-lambdas';
import {cleanUpBuckets, getRemotionS3Buckets} from './cleanup/s3-buckets';
-import {LambdaRoutines} from './constants';
+import {
+ LambdaRoutines,
+ LAMBDA_INITIALIZED_KEY,
+ LAMBDA_S3_WEBSITE_DEPLOY,
+} from './constants';
import {createLambda} from './create-lambda';
import {deploySite} from './deploy-site';
+import {lambdaLs, lambdaReadFile} from './io';
import {makeS3Url} from './make-s3-url';
import {sleep} from './sleep';
+import {streamToString} from './stream-to-string';
-const DEPLOY = true;
+const DEPLOY = false;
const getFnName = async (): Promise<{
functionName: string;
@@ -36,9 +43,12 @@ const getFnName = async (): Promise<{
const lambdas = await getRemotionLambdas(lambdaClient);
const {remotionBuckets} = await getRemotionS3Buckets(s3Client);
+ const websiteBuckets = remotionBuckets.filter((b) =>
+ b.startsWith(LAMBDA_S3_WEBSITE_DEPLOY)
+ );
return {
functionName: lambdas[0].FunctionName as string,
- bucketUrl: makeS3Url(remotionBuckets[0] as string),
+ bucketUrl: makeS3Url('remotion-bucket-0.015890651294784286'),
};
};
@@ -49,20 +59,33 @@ CliInternals.xns(async () => {
type: LambdaRoutines.start,
payload: {
chunkSize: 20,
- composition: 'my-video',
+ composition: 'Main',
serveUrl: bucketUrl,
- inputProps: {
- duration: 1000,
- },
+ inputProps: {},
},
});
+ console.log(bucketUrl);
for (let i = 0; i < 3000; i++) {
await sleep(1000);
const status = await checkLambdaStatus(functionName, res.bucketName);
console.log(status);
if (status.done) {
console.log('Done! ' + res.bucketName);
- process.exit(0);
+ break;
}
}
+
+ const files = await lambdaLs({
+ bucketName: res.bucketName,
+ forceS3: true,
+ });
+ const logs = files.filter((f) => f.Key?.startsWith(LAMBDA_INITIALIZED_KEY));
+
+ for (const log of logs) {
+ const content = await lambdaReadFile({
+ bucketName: res.bucketName,
+ key: log.Key as string,
+ });
+ writeFileSync(log.Key as string, await streamToString(content));
+ }
});