{"record":{"id":"62e4d638f66b3131","repo":"remotion-dev/remotion","slug":"remotion-app-region-is-not-set","errorCode":null,"errorMessage":"REMOTION_APP_REGION is not set","messagePattern":"REMOTION_APP_REGION is not set","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"packages/lambda-python/testclient_render_media.py","lineNumber":14,"sourceCode":"\nfrom remotion_lambda import RenderMediaParams, Privacy, ValidStillImageFormats, Webhook\nfrom remotion_lambda import RemotionClient\nimport os\nfrom dotenv import load_dotenv\nimport boto3\nfrom botocore.config import Config\n\nload_dotenv()\n\n# Load env variables\nREMOTION_APP_REGION = os.getenv('REMOTION_APP_REGION')\nif not REMOTION_APP_REGION:\n    raise Exception(\"REMOTION_APP_REGION is not set\")\n\nREMOTION_APP_FUNCTION_NAME = os.getenv('REMOTION_APP_FUNCTION_NAME')\nif not REMOTION_APP_FUNCTION_NAME:\n    raise Exception(\"REMOTION_APP_FUNCTION_NAME is not set\")\n\nREMOTION_APP_SERVE_URL = os.getenv('REMOTION_APP_SERVE_URL')\nif not REMOTION_APP_SERVE_URL:\n    raise Exception(\"REMOTION_APP_SERVE_URL is not set\")\n\n\n# --- NEW: Create a custom botocore Config for timeouts ---\n# This configuration will apply to both S3 and Lambda clients created by RemotionClient\n# if passed via the botocore_config parameter.\ncustom_botocore_config = Config(\n    connect_timeout=30,  # Max 30 seconds to establish a connection\n    read_timeout=60,     # Max 60 seconds to receive data after connection\n    retries={'max_attempts': 3, 'mode': 'adaptive'}, # Retry up to 3 times on certain errors\n    # You can add more settings here, e.g., proxies","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-python/testclient_render_media.py#L1-L32","documentation":"Raised by the example test client testclient_render_media.py when the REMOTION_APP_REGION environment variable is empty after dotenv loading. The example scripts refuse to construct a RemotionClient without an AWS region, because the underlying boto3 clients need one to make calls.","triggerScenarios":"Running `python testclient_render_media.py` without a .env file in the working directory, or with REMOTION_APP_REGION missing/blank in that file. Also occurs if load_dotenv() does not find the .env because the script is run from a different cwd.","commonSituations":"Fresh checkout of the lambda-python package without copying .env.example to .env; running the script from the repo root instead of packages/lambda-python; CI shells that strip the environment.","solutions":["Create packages/lambda-python/.env from .env.example and set REMOTION_APP_REGION (e.g. 'us-east-1').","Run the script from packages/lambda-python so load_dotenv() picks up the local .env.","Export the variable inline: `REMOTION_APP_REGION=us-east-1 python testclient_render_media.py`.","Verify with `python -c \"import os;from dotenv import load_dotenv;load_dotenv();print(os.getenv('REMOTION_APP_REGION'))\"`."],"exampleFix":"// before\n# .env is missing or empty\n// after\n# packages/lambda-python/.env\nREMOTION_APP_REGION=us-east-1\nREMOTION_APP_FUNCTION_NAME=my-render-fn\nREMOTION_APP_SERVE_URL=https://example.com/site","handlingStrategy":"validation","validationCode":"import os\nfrom dotenv import load_dotenv\nload_dotenv()\nrequired = ['REMOTION_APP_REGION', 'REMOTION_APP_FUNCTION_NAME', 'REMOTION_APP_SERVE_URL']\nmissing = [k for k in required if not os.getenv(k)]\nif missing:\n    raise SystemExit(f'Missing env vars: {missing}. Copy .env.example to .env and fill them.')","typeGuard":"def has_region(v): return isinstance(v, str) and v.strip() != ''","tryCatchPattern":"try:\n    assert os.getenv('REMOTION_APP_REGION'), 'REMOTION_APP_REGION is not set'\nexcept AssertionError as e:\n    print(e); sys.exit(1)","preventionTips":["Copy .env.example to .env at package setup and fill all REMOTION_APP_* values.","Run example scripts from packages/lambda-python so load_dotenv resolves.","Validate required env vars up front before constructing the client.","Document the required variables in your project README."],"tags":["python","lambda","configuration","environment","example"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}