Skip to content

🎥 Make videos programmatically with React

return already existed field for getOrCreateBucket()

Jonny Burger11cd34f6d372
diff --git a/packages/docs/docs/lambda/getorcreatebucket.md b/packages/docs/docs/lambda/getorcreatebucket.md
index 3618ea70da..ad121ab216 100644
--- a/packages/docs/docs/lambda/getorcreatebucket.md
+++ b/packages/docs/docs/lambda/getorcreatebucket.md
@@ -42,6 +42,11 @@ A promise resolving to an object with the following property:
The name of your bucket that was found or created.
+### `alreadyExisted`
+
+<AvailableFrom v="v3.3.78" />
+A boolean indicating whether the bucket already existed or was newly created.
+
## See also
- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/lambda/src/api/get-or-create-bucket.ts)
diff --git a/packages/lambda/src/api/get-or-create-bucket.ts b/packages/lambda/src/api/get-or-create-bucket.ts
index 90d6254bc5..ef60e5b1e9 100644
--- a/packages/lambda/src/api/get-or-create-bucket.ts
+++ b/packages/lambda/src/api/get-or-create-bucket.ts
@@ -11,6 +11,7 @@ export type GetOrCreateBucketInput = {
export type GetOrCreateBucketOutput = {
bucketName: string;
+ alreadyExisted: boolean;
};
/**
* @description Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
@@ -34,7 +35,7 @@ export const getOrCreateBucket = async (
if (remotionBuckets.length === 1) {
options.onBucketEnsured?.();
- return {bucketName: remotionBuckets[0].name};
+ return {bucketName: remotionBuckets[0].name, alreadyExisted: true};
}
const bucketName = makeBucketName(options.region);
@@ -45,5 +46,5 @@ export const getOrCreateBucket = async (
});
options.onBucketEnsured?.();
- return {bucketName};
+ return {bucketName, alreadyExisted: false};
};