remotion-dev/remotion · error · error

could not list S3 buckets: %w

Error message

could not list S3 buckets: %w

What it means

Thrown by getRemotionBuckets when ListBuckets fails. ListBuckets is the very first S3 call the bucket-resolution logic makes; if the caller cannot list buckets at all, no Remotion bucket can be discovered or created. The wrapped error is usually AccessDenied or a regional endpoint problem.

Source

Thrown at packages/lambda-go/s3.go:97

// isBucketInRegion reports whether the given bucket lives in region.
func isBucketInRegion(svc bucketLocationGetter, bucket string, region string) (bool, error) {
	out, err := svc.GetBucketLocation(context.TODO(), &s3.GetBucketLocationInput{Bucket: new(bucket)})
	if err != nil {
		var awsErr smithy.APIError
		if errors.As(err, &awsErr) && awsErr.ErrorCode() == "NoSuchBucket" {
			return false, nil
		}
		return false, fmt.Errorf("could not get location of S3 bucket %q: %w", bucket, err)
	}
	location := string(out.LocationConstraint)
	return location == region || (location == "" && region == regionUsEast1), nil
}

// getRemotionBuckets lists the Remotion buckets that exist in region.
func getRemotionBuckets(svc *s3.Client, region string) ([]string, error) {
	out, err := svc.ListBuckets(context.TODO(), &s3.ListBucketsInput{})
	if err != nil {
		return nil, fmt.Errorf("could not list S3 buckets: %w", err)
	}
	buckets := []string{}
	for _, bucket := range out.Buckets {
		name := aws.ToString(bucket.Name)
		if !strings.HasPrefix(name, bucketNamePrefix) {
			continue
		}
		isInRegion, err := isBucketInRegion(svc, name, region)
		if err != nil {
			return nil, err
		}
		if isInRegion {
			buckets = append(buckets, name)
		}
	}
	return buckets, nil
}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Add `s3:ListAllMyBuckets` to the IAM policy on `*`.
  2. Verify the region in the AWS config resolves to a valid S3 endpoint.
  3. From a VPC-only subnet, add an S3 gateway endpoint so ListBuckets can reach the control plane.
  4. Inspect the wrapped error code to distinguish AccessDenied from network/endpoint issues.
Defensive patterns

Strategy: validation

Try / catch

buckets, err := getRemotionBuckets(svc, region)
if err != nil {
    var awsErr smithy.APIError
    if errors.As(err, &awsErr) && awsErr.ErrorCode() == "AccessDenied" {
        // missing s3:ListAllMyBuckets - widen the policy
    }
    return nil, err
}

Prevention

When it happens

Trigger: svc.ListBuckets returns an error because the IAM principal lacks s3:ListAllMyBuckets, because the region endpoint is misconfigured, or because of a network failure reaching the S3 control plane.

Common situations: Scoped-down IAM roles in production that only allow specific bucket ARNs and forget the global list permission. Air-gapped or VPC-only networks without an S3 VPC endpoint.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/5cd811ac3048539a. Report an issue: GitHub.