{"record":{"id":"eee7e0c0224d3323","repo":"remotion-dev/remotion","slug":"serve-url-parameter-is-required-and-cannot-be-em","errorCode":null,"errorMessage":"'serve_url' parameter is required and cannot be empty or whitespace","messagePattern":"'serve_url' parameter is required and cannot be empty or whitespace","errorType":"validation","errorClass":"RemotionInvalidArgumentException","httpStatus":null,"severity":"error","filePath":"packages/lambda-python/remotion_lambda/remotionclient.py","lineNumber":169,"sourceCode":"        ...     session=session,\n        ...     config=config\n        ... )\n\n        Legacy usage (deprecated):\n\n        >>> client = RemotionClient(\n        ...     region='us-east-1',\n        ...     serve_url='https://api.example.com',\n        ...     function_name='my-function',\n        ...     access_key='AKIA...',\n        ...     secret_key='secret...'\n        ... )\n        \"\"\"\n       # Validate required parameters at construction time\n        if not region or not region.strip():\n            raise RemotionInvalidArgumentException(\"'region' parameter is required and cannot be empty or whitespace\")\n        if not serve_url or not serve_url.strip():\n            raise RemotionInvalidArgumentException(\"'serve_url' parameter is required and cannot be empty or whitespace\")\n        if not function_name or not function_name.strip():\n            raise RemotionInvalidArgumentException(\"'function_name' parameter is required and cannot be empty or whitespace\")\n\n\n        # Check for conflicting authentication methods\n        if session and (access_key or secret_key):\n            raise RemotionInvalidArgumentException(\n                \"Cannot specify both 'session' and explicit credentials \"\n                \"('access_key'/'secret_key'). Please use only 'session'.\"\n            )\n\n        # Handle deprecated credential parameters\n        if access_key is not None or secret_key is not None:\n            warnings.warn(\n                \"Parameters 'access_key' and 'secret_key' are deprecated \"\n                \"as of version 4.0.376 and will be removed in version 5.0.0. \"\n                \"Please migrate to using 'session' for improved security. \",\n                DeprecationWarning,","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-python/remotion_lambda/remotionclient.py#L151-L187","documentation":"Constructor-time validation in the Python RemotionClient. Raised when the 'serve_url' argument is None, empty, or whitespace-only. serve_url points to the deployed Remotion bundle (a Studio URL or an S3-hosted entry point URL) and is mandatory for every render call.","triggerScenarios":"Instantiating RemotionClient with serve_url=None, '', or a whitespace string; passing a serve_url value read from a missing config key; forgetting to deploy the bundle first and so having no URL to pass.","commonSituations":"Skipping the `npx remotion lambda functions deploy` step; pointing at the wrong environment's URL; passing the S3 bucket name instead of the full serve URL; misreading deploy output that lists serveUrl separately from functionName.","solutions":["Deploy the bundle first (`remotion lambda sites create` / `functions deploy`) and capture the printed serveUrl.","Pass the full URL (e.g. 'https://remotionlambda-....s3.region.amazonaws.com') as serve_url.","Load serve_url from config with a fallback guard that fails loudly if missing."],"exampleFix":"// before\nclient = RemotionClient(\n    region=region,\n    serve_url='',  # forgot to set\n    function_name=fn,\n)\n\n# after\nserve_url = config.get('serve_url')\nif not serve_url:\n    raise RuntimeError('Run `remotion lambda sites create` first and set serve_url')\nclient = RemotionClient(\n    region=region,\n    serve_url=serve_url,\n    function_name=fn,\n)","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\n\ndef validate_serve_url(url: str) -> str:\n    if not url or not url.strip():\n        raise ValueError('serve_url required')\n    parsed = urlparse(url.strip())\n    if parsed.scheme not in ('http', 'https') or not parsed.netloc:\n        raise ValueError(f'invalid serve_url: {url!r}')\n    return url.strip()","typeGuard":"def is_valid_serve_url(value) -> bool:\\n    if not isinstance(value, str) or not value.strip():\\n        return False\\n    p = urlparse(value.strip())\\n    return p.scheme in ('http', 'https') and bool(p.netloc)","tryCatchPattern":"try:\\n    client = RemotionClient(region=region, serve_url=serve_url, function_name=fn)\\nexcept RemotionInvalidArgumentException as e:\\n    raise SystemExit(f'serve_url misconfigured: {e}')","preventionTips":["Deploy the bundle first and capture the serveUrl printed by the CLI.","Store serve_url in config and fail fast if it is missing.","Validate the URL parses as http(s) with a netloc before construction."],"tags":["python","validation","constructor","serve-url","lambda"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}