Skip to main content

getOrCreateBucket()

Creates a Cloud Storage bucket for Remotion Cloud Run in your GCP project. If one already exists, it will get returned instead.

Only 1 bucket per region is necessary for Remotion Cloud Run to function.

import {getOrCreateBucket} from '@remotion/cloudrun';

const {bucketName, alreadyExisted} = await getOrCreateBucket({
  region: 'us-east1',
});

console.log(bucketName); // "remotioncloudrun-32df3p"

Arguments​

An object with the following properties:

region​

The GCP region which you want to create a bucket in.

updateBucketState?​

Callback function that returns a state (string) of operation. Used by the CLI to provide a progress update. State will be one of the following;

  • Checking for existing bucket
  • Creating new bucket
  • Created bucket
  • Using existing bucket

Return value​

A promise resolving to an object with the following properties:

bucketName​

The name of your bucket that was found or created.

alreadyExisted​

A boolean indicating whether the bucket already existed or was newly created.

Compatibility​

ServersEnvironments
Node.js
Bun
Serverless Functions
Node.js runtime

For serverless functions, use the light client.

See also​