remotion-dev/remotion · error · Exception
REMOTION_APP_REGION is not set
Error message
REMOTION_APP_REGION is not set
What it means
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.
Source
Thrown at packages/lambda-python/testclient_render_media.py:14
from remotion_lambda import RenderMediaParams, Privacy, ValidStillImageFormats, Webhook
from remotion_lambda import RemotionClient
import os
from dotenv import load_dotenv
import boto3
from botocore.config import Config
load_dotenv()
# Load env variables
REMOTION_APP_REGION = os.getenv('REMOTION_APP_REGION')
if not REMOTION_APP_REGION:
raise Exception("REMOTION_APP_REGION is not set")
REMOTION_APP_FUNCTION_NAME = os.getenv('REMOTION_APP_FUNCTION_NAME')
if not REMOTION_APP_FUNCTION_NAME:
raise Exception("REMOTION_APP_FUNCTION_NAME is not set")
REMOTION_APP_SERVE_URL = os.getenv('REMOTION_APP_SERVE_URL')
if not REMOTION_APP_SERVE_URL:
raise Exception("REMOTION_APP_SERVE_URL is not set")
# --- NEW: Create a custom botocore Config for timeouts ---
# This configuration will apply to both S3 and Lambda clients created by RemotionClient
# if passed via the botocore_config parameter.
custom_botocore_config = Config(
connect_timeout=30, # Max 30 seconds to establish a connection
read_timeout=60, # Max 60 seconds to receive data after connection
retries={'max_attempts': 3, 'mode': 'adaptive'}, # Retry up to 3 times on certain errors
# You can add more settings here, e.g., proxiesView on GitHub (pinned to 78fe4bb3fd)
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'))"`.
Example fix
// before # .env is missing or empty // after # packages/lambda-python/.env REMOTION_APP_REGION=us-east-1 REMOTION_APP_FUNCTION_NAME=my-render-fn REMOTION_APP_SERVE_URL=https://example.com/site
Defensive patterns
Strategy: validation
Validate before calling
import os
from dotenv import load_dotenv
load_dotenv()
required = ['REMOTION_APP_REGION', 'REMOTION_APP_FUNCTION_NAME', 'REMOTION_APP_SERVE_URL']
missing = [k for k in required if not os.getenv(k)]
if missing:
raise SystemExit(f'Missing env vars: {missing}. Copy .env.example to .env and fill them.') Type guard
def has_region(v): return isinstance(v, str) and v.strip() != ''
Try / catch
try:
assert os.getenv('REMOTION_APP_REGION'), 'REMOTION_APP_REGION is not set'
except AssertionError as e:
print(e); sys.exit(1) Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- REMOTION_APP_FUNCTION_NAME is not set
- REMOTION_APP_SERVE_URL is not set
- REMOTION_APP_REGION is not set
- REMOTION_APP_FUNCTION_NAME is not set
- REMOTION_APP_SERVE_URL is not set
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/62e4d638f66b3131.
Report an issue: GitHub.