remotion-dev/remotion · error · TypeError
"region" parameter must be a string, but is ${JSON.stringify
Error message
"region" parameter must be a string, but is ${JSON.stringify(region)} What it means
Thrown by validateRegion() when the region argument is not a string. This is the type guard before the GCP_REGIONS membership check. Region is required for nearly every Cloud Run API to address resources in the correct Google Cloud location.
Source
Thrown at packages/cloudrun/src/shared/validate-region.ts:6
import type {GcpRegion} from '../pricing/gcp-regions';
import {GCP_REGIONS} from '../pricing/gcp-regions';
export const validateRegion = (region: unknown) => {
if (typeof region !== 'string') {
throw new TypeError(
`"region" parameter must be a string, but is ${JSON.stringify(region)}`,
);
}
// check region is part of GCP_REGIONS list
if (!GCP_REGIONS.includes(region as GcpRegion)) {
throw new TypeError(
`"region" parameter must be one of ${GCP_REGIONS.join(
', ',
)}, but is ${JSON.stringify(region)}`,
);
}
return region as GcpRegion;
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass a valid GCP region string such as 'us-east1'.
- Default region when unset: const region = config.region ?? 'us-east1' (the package DEFAULT_REGION).
- Validate config at startup.
Example fix
// before
const { REGION } = process.env; // undefined
await deployService({ region: REGION, ... });
// after
const region = process.env.REGION ?? 'us-east1';
await deployService({ region, ... }); Defensive patterns
Strategy: type-guard
Validate before calling
import { validateRegion } from '@remotion/cloudrun/shared';
validateRegion(region); Type guard
function isRegionString(v: unknown): v is string {
return typeof v === 'string';
} Try / catch
const region = typeof inputRegion === 'string' ? inputRegion : 'us-east1';
Prevention
- Default region to 'us-east1' (the package default) when unset.
- Type your config so region is always a string.
- Assert env vars are set at process start.
When it happens
Trigger: Passing a non-string region (undefined, null, number, object) to any Cloud Run API that validates region.
Common situations: Region read from an unset env var; passing a config object instead of its region string property; destructuring typo leaving region undefined.
Related errors
- Bucket creation is required, but no region has been passed.
- If determining Cloudrun Url from serviceName, region must be
- ${region} is not a valid GCP region. Must be one of: ${GCP_R
- The 'project-id' argument must be a string, but is ${JSON.st
- "region" parameter must be one of ${GCP_REGIONS.join(', ')},
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/3f862a3f00a3160e.
Report an issue: GitHub.