Skip to content

🎥 Make videos programmatically with React

codec support

Jonny Burgerb15307f0290f
diff --git a/packages/cli/src/index.tsx b/packages/cli/src/index.tsx
index 0355a347a8..5e4e5b4c3d 100644
--- a/packages/cli/src/index.tsx
+++ b/packages/cli/src/index.tsx
@@ -5,7 +5,7 @@ import {getCliOptions} from './get-cli-options';
import {getConfigFileName} from './get-config-file-name';
import {loadConfigFile} from './load-config';
import {Log} from './log';
-import {parsedCli} from './parse-command-line';
+import {parseCommandLine, parsedCli} from './parse-command-line';
import {previewCommand} from './preview';
import {printHelp} from './print-help';
import {createOverwriteableCliOutput, makeProgressBar} from './progress-bar';
@@ -48,4 +48,5 @@ export const CliInternals = {
loadConfigFile,
getConfigFileName,
getCliOptions,
+ parseCommandLine,
};
diff --git a/packages/docs/docs/lambda.md b/packages/docs/docs/lambda.md
index 5fad65e77c..6d8cabacc1 100644
--- a/packages/docs/docs/lambda.md
+++ b/packages/docs/docs/lambda.md
@@ -86,7 +86,7 @@ A mechanism that determines after a render which frames rendered the slowest opt
- [ ] Costs are not calculated accurately (probably slightly higher than effective)
- [ ] Parallelism is not configurable
- [ ] Rendering using more than 1000 chunks is undefined behavior, things will break
-- [ ] `eu-central-1` region is hardcoded
+- [x] ~`eu-central-1` region is hardcoded~
- [ ] 2048 MB RAM is hardcoded
- [ ] Lambda timeout of 120 seconds is hardcoded
diff --git a/packages/lambda/src/api/get-or-create-bucket.ts b/packages/lambda/src/api/get-or-create-bucket.ts
index c952ffcdf6..9f588a57c5 100644
--- a/packages/lambda/src/api/get-or-create-bucket.ts
+++ b/packages/lambda/src/api/get-or-create-bucket.ts
@@ -1,24 +1,24 @@
-import {CreateBucketCommand, ListBucketsCommand} from '@aws-sdk/client-s3';
+import {CreateBucketCommand} from '@aws-sdk/client-s3';
import {AwsRegion} from '../pricing/aws-regions';
import {getS3Client} from '../shared/aws-clients';
import {REMOTION_BUCKET_PREFIX} from '../shared/constants';
import {randomHash} from '../shared/random-hash';
+import {getRemotionS3Buckets} from './get-buckets';
export const getOrCreateBucket = async (options: {region: AwsRegion}) => {
- const existingBuckets = await getS3Client(options.region).send(
- new ListBucketsCommand({})
- );
- const withPrefix = (existingBuckets.Buckets ?? []).filter((b) => {
- return b.Name?.startsWith(REMOTION_BUCKET_PREFIX);
- });
- if (withPrefix.length > 1) {
+ const {remotionBuckets} = await getRemotionS3Buckets(options.region);
+ if (remotionBuckets.length > 1) {
throw new Error(
- `You have multiple buckets in your S3 region starting with "${REMOTION_BUCKET_PREFIX}". This is an error, please delete buckets so that you have one maximum.`
+ `You have multiple buckets (${remotionBuckets.map(
+ (b) => b.Name
+ )}) in your S3 region (${
+ options.region
+ }) starting with "${REMOTION_BUCKET_PREFIX}". This is an error, please delete buckets so that you have one maximum.`
);
}
- if (withPrefix.length === 1) {
- return withPrefix[0].Name as string;
+ if (remotionBuckets.length === 1) {
+ return remotionBuckets[0].Name as string;
}
const bucketName = REMOTION_BUCKET_PREFIX + randomHash();
diff --git a/packages/lambda/src/api/iam-validation/role-permissions.ts b/packages/lambda/src/api/iam-validation/role-permissions.ts
index c761a6228c..26f3026810 100644
--- a/packages/lambda/src/api/iam-validation/role-permissions.ts
+++ b/packages/lambda/src/api/iam-validation/role-permissions.ts
@@ -14,7 +14,13 @@ export const rolePermissions: {
resource: [`arn:aws:s3:::*`],
},
{
- actions: [s3.GetObject, s3.DeleteObject, s3.PutObjectAcl, s3.PutObject],
+ actions: [
+ s3.GetObject,
+ s3.DeleteObject,
+ s3.PutObjectAcl,
+ s3.PutObject,
+ s3.GetBucketLocation,
+ ],
resource: [`arn:aws:s3:::${REMOTION_BUCKET_PREFIX}*`],
},
{
diff --git a/packages/lambda/src/cli/index.ts b/packages/lambda/src/cli/index.ts
index 9ff8f5e38c..1644ce007f 100644
--- a/packages/lambda/src/cli/index.ts
+++ b/packages/lambda/src/cli/index.ts
@@ -42,6 +42,7 @@ const matchCommand = async () => {
export const cli = async () => {
// TODO: TS hardcoded, support JS just as in normal CLI
CliInternals.loadConfigFile(CliInternals.getConfigFileName(false), false);
+ CliInternals.parseCommandLine();
try {
await matchCommand();
} catch (err) {