remotion-dev/remotion · error · Error

Either cloudRunUrl or serviceName must be provided

Error message

Either cloudRunUrl or serviceName must be provided

What it means

Thrown by getCloudrunEndpoint() when both cloudRunUrl and serviceName are null/undefined. Exactly one of the two must be supplied so the function can resolve the render endpoint URL.

Source

Thrown at packages/cloudrun/src/api/helpers/get-cloudrun-endpoint.ts:18

import {validateCloudRunUrl} from '../../shared/validate-cloudrun-url';
import {validateRegion} from '../../shared/validate-region';
import {validateServiceName} from '../../shared/validate-service-name';
import {getServiceInfo} from '../get-service-info';

export type getCloudrunEndpointInput = {
	cloudRunUrl?: string | null;
	serviceName?: string | null;
	region?: string;
};

export const getCloudrunEndpoint = async ({
	cloudRunUrl,
	serviceName,
	region,
}: getCloudrunEndpointInput): Promise<string> => {
	if (!cloudRunUrl && !serviceName)
		throw new Error('Either cloudRunUrl or serviceName must be provided');
	if (cloudRunUrl && serviceName)
		throw new Error(
			'Either cloudRunUrl or serviceName must be provided, not both',
		);

	let cloudRunEndpoint = '';
	if (cloudRunUrl) {
		validateCloudRunUrl(cloudRunUrl);
		cloudRunEndpoint = cloudRunUrl;
	}

	if (serviceName) {
		if (!region)
			throw new Error(
				'If determining Cloudrun Url from serviceName, region must be provided',
			);
		validateServiceName(serviceName);
		const validatedRegion = validateRegion(region);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Provide either cloudRunUrl (the HTTPS endpoint of a deployed Cloud Run service) or serviceName (the deployed service name).
  2. Validate the input object has exactly one of the two keys before calling.

Example fix

// before
await getCloudrunEndpoint({region: 'us-central1'});
// after
await getCloudrunEndpoint({serviceName: 'remotion-4.0.0-mem2', region: 'us-central1'});
Defensive patterns

Strategy: validation

Validate before calling

const hasUrl = !!opts.cloudRunUrl;
const hasName = !!opts.serviceName;
if (!hasUrl && !hasName) {
  throw new Error('Provide either cloudRunUrl or serviceName');
}
await getCloudrunEndpoint(opts);

Type guard

type EndpointInput = {cloudRunUrl: string; serviceName?: null} | {serviceName: string; region: string; cloudRunUrl?: null};
const isValidEndpointInput = (i): i is EndpointInput =>
  (!!i.cloudRunUrl && !i.serviceName) || (!!i.serviceName && !!i.region && !i.cloudRunUrl);

Prevention

When it happens

Trigger: Calling getCloudrunEndpoint({}) or getCloudrunEndpoint({cloudRunUrl: null, serviceName: null}) — i.e., omitting both identifying fields.

Common situations: Building render options programmatically where both fields are conditionally set and neither ends up populated, or destructuring a config object that lacks both keys.

Related errors


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