remotion-dev/remotion · error · error

could not load AWS config: %w

Error message

could not load AWS config: %w

What it means

Thrown by newS3Client when the AWS SDK v2 cannot resolve credentials and region for the S3 client. Identical root cause to 1180 but on the S3 code path — used when serializing input props that exceed the inline payload size and must be uploaded to S3.

Source

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

	if err != nil {
		return "", err
	}
	return bucketNamePrefix + strings.ReplaceAll(region, "-", "") + "-" + suffix, nil
}

func inputPropsKey(hash string) string {
	return fmt.Sprintf("input-props/%s.json", hash)
}

// newS3Client creates an S3 client using the same shared config resolution as
// the Lambda client in invocations.go.
func newS3Client(region string, forcePathStyle bool) (*s3.Client, error) {
	awsConfig, err := config.LoadDefaultConfig(
		context.TODO(),
		config.WithRegion(region),
	)
	if err != nil {
		return nil, fmt.Errorf("could not load AWS config: %w", err)
	}
	return s3.NewFromConfig(awsConfig, func(options *s3.Options) {
		options.UsePathStyle = forcePathStyle
	}), nil
}

// 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

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Run `aws configure` or set AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_REGION in the environment.
  2. Ensure config.Region is populated on the render request so the SDK does not rely on ambient region resolution.
  3. If the props are small, confirm whether you actually need S3 upload; if not, this path is bypassed (see needsUpload).
Defensive patterns

Strategy: validation

Validate before calling

// Validate config before serializeInputProps would need S3.
func canReachS3(ctx context.Context, region string) error {
    cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(region))
    if err != nil { return err }
    _, err = cfg.Credentials.Retrieve(ctx)
    return err
}

Prevention

When it happens

Trigger: serializeInputProps calls newS3Client for a payload that needs S3 upload, and the AWS SDK config chain (env vars, shared profile, IMDS) yields nothing valid for the given region.

Common situations: Same as 1180: missing AWS credentials/region in the runtime environment, expired SSO, CI missing AWS_REGION. Only fires when input props are large enough to require S3 rather than an inline payload.

Related errors


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