remotion-dev/remotion · error · Exception
Failed to upload to S3: {$exception->getMessage()}
Error message
Failed to upload to S3: {$exception->getMessage()} What it means
Thrown by uploadToS3 when the AwsException caught during putObject is re-raised. This path runs only when the input props are large enough to require S3 storage rather than an inline payload (see needsUpload). The bucket exists but the object write was rejected — usually a permissions or bucket-policy problem.
Source
Thrown at packages/lambda-php/src/PHPClient.php:205
}
}
/**
* Upload payload to S3
*/
private function uploadToS3(string $bucket, string $key, string $payload): void
{
$s3Client = $this->createS3Client();
try {
$s3Client->putObject([
'Bucket' => $bucket,
'Key' => $key,
'Body' => $payload,
'ContentType' => 'application/json',
]);
} catch (AwsException $exception) {
throw new Exception("Failed to upload to S3: {$exception->getMessage()}");
}
}
/**
* Determine if payload needs to be uploaded to S3
*/
protected function needsUpload(int $payloadSize, string $renderType): bool
{
// Constants based on AWS Lambda limits with margin for other payload data
$margin = 5_000 + 1_024; // 5KB margin + 1KB for webhook data
$maxStillInlineSize = 5_000_000 - $margin;
$maxVideoInlineSize = 200_000 - $margin;
$maxSize = ($renderType === 'still') ? $maxStillInlineSize : $maxVideoInlineSize;
if ($payloadSize < $maxSize) {
return false;
}View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Grant s3:PutObject on `arn:aws:s3:::<bucket>/input-props/*` to the caller's role.
- Inspect $exception->getAwsErrorCode(): AccessDenied → permission; NoSuchBucket → bucket gone; SlowDown → retry with backoff.
- Reduce input props size or pre-upload bulk data and pass a URL reference.
- If a bucket policy enforces a VPC endpoint, route the request through it.
Defensive patterns
Strategy: try-catch
Try / catch
try {
$this->uploadToS3($bucket, $key, $payload);
} catch (Exception $e) {
if (strpos($e->getMessage(), 'AccessDenied') !== false) {
// grant s3:PutObject on arn:aws:s3:::<bucket>/input-props/*
}
throw $e;
} Prevention
- Grant s3:PutObject on the input-props prefix to the caller role.
- Pre-upload large data yourself and pass a reference URL.
- Surface getAwsErrorCode() in the exception message for diagnosis.
When it happens
Trigger: $s3Client->putObject throws AwsException because of AccessDenied (no s3:PutObject on the bucket/prefix), NoSuchBucket (bucket removed between resolution and upload), a bucket policy denying the caller's network/principal, or transient SlowDown.
Common situations: IAM policy scoped to specific keys that omits the `input-props/` prefix. A bucket policy enforcing TLS-only or VPC-endpoint-only puts from outside that network. Very large payloads over the SDK's comfortable streaming size.
Related errors
- failed to upload inputProps to S3: %w
- Failed to create bucket: {$exception->getMessage()}
- You have multiple buckets (%s) in your S3 region (%s) starti
- Failed to invoke Lambda function
- Error serializing inputProps. Check it has no circular refer
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/b49bc08a448a3e5c.
Report an issue: GitHub.