remotion-dev/remotion · error · RemotionInvalidArgumentException

Invalid S3 client parameters for put_object: {e}

Error message

Invalid S3 client parameters for put_object: {e}

What it means

Raised when boto3 rejects the parameters to put_object with a ParamValidationError during input-props upload. Network/permission errors (ClientError) are re-raised separately; this fires only for malformed parameter shapes such as a non-string bucket_name or key, or a missing Body.

Source

Thrown at packages/lambda-python/remotion_lambda/remotionclient.py:371

        except ParamValidationError as e:
            raise RemotionInvalidArgumentException(
                f"Invalid S3 client parameters for create_bucket: {e}"
            ) from e

    def _upload_to_s3(self, bucket_name: str, key: str, payload: str) -> None: # Added type hints
        """Upload payload to S3."""
        s3_client = self._create_s3_client()
        try:
            s3_client.put_object(
                Bucket=bucket_name,
                Key=key,
                Body=payload,
                ContentType='application/json',
            )
        except ClientError as e:
            raise e
        except ParamValidationError as e:
            raise RemotionInvalidArgumentException(
                f"Invalid S3 client parameters for put_object: {e}"
            ) from e

    def _needs_upload(self, payload_size: int, render_type: RenderType) -> bool: # Added type hints
        """Determine if payload needs to be uploaded to S3."""
        margin = 5_000 + 1024  # 5KB margin + 1KB for webhook data
        max_still_inline_size = 5_000_000 - margin
        max_video_inline_size = 200_000 - margin

        # Using RenderType Enum for comparison
        max_size = (
            max_still_inline_size if render_type == 'still' else max_video_inline_size
        )

        if payload_size > max_size:
            logger.warning(
                "Warning: The props are over %sKB (%sKB) in size. Uploading them to S3 to "
                "circumvent AWS Lambda payload size, which may lead to slowdown.",

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Inspect __cause__ for the exact ParamValidationError report and the offending parameter.
  2. Confirm inputPropsKey and bucket_name resolve to non-empty strings before calling render APIs.
  3. Ensure the payload passed to the render call is itself a valid (json-serializable) object.
  4. Recreate the client with a valid region/Session so the internal S3 client is correctly configured.

Example fix

// before
client = RemotionClient(region='us-east-1', serve_url=..., function_name='')
client.renderMedia(...)  # empty key chain leads to invalid put_object params

# after
client = RemotionClient(region='us-east-1', serve_url=..., function_name='remotion-render-...')
client.renderMedia(...)
Defensive patterns

Strategy: try-catch

Validate before calling

def preflight_put_object(bucket_name: str, key: str, payload: str) -> None:
    if not (isinstance(bucket_name, str) and bucket_name):
        raise ValueError(f'invalid bucket: {bucket_name!r}')
    if not (isinstance(key, str) and key):
        raise ValueError(f'invalid key: {key!r}')
    if not isinstance(payload, (str, bytes)):
        raise ValueError(f'invalid payload type: {type(payload).__name__}')

Type guard

def is_valid_s3_key(value) -> bool:\n    return isinstance(value, str) and len(value) >= 1 and len(value) <= 1024

Try / catch

try:\n    client.render_media(...)\nexcept RemotionInvalidArgumentException as e:\n    log.error('put_object param error: %s', e.__cause__)\n    raise

Prevention

When it happens

Trigger: Triggered from _upload_to_s3 when the computed key is None/empty, the bucket name resolved to a non-string, the payload Body is not valid bytes/str, or the internal S3 client was misconfigured.

Common situations: Hash generation returning None so the inputPropsKey is empty; bucket lookup returning a non-scalar; mocking S3 client with incomplete stubs in tests; payload variable accidentally None due to upstream serialization bug.

Related errors


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