remotion-dev/remotion · error · Error

Either cloudRunUrl or serviceName must be provided, not both

Error message

Either cloudRunUrl or serviceName must be provided, not both

What it means

Thrown by getCloudrunEndpoint() when both cloudRunUrl and serviceName are provided simultaneously. The function requires exactly one identifier; providing both is ambiguous and rejected.

Source

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

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);
		const {uri} = await getServiceInfo({serviceName, region: validatedRegion});
		cloudRunEndpoint = uri;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass only one of cloudRunUrl or serviceName.
  2. If you have both, prefer cloudRunUrl (it skips the extra getServiceInfo lookup) and drop serviceName.
  3. Add a runtime XOR check at the call site.

Example fix

// before
await getCloudrunEndpoint({cloudRunUrl: url, serviceName: name, region});
// after
await getCloudrunEndpoint({cloudRunUrl: url, region});
Defensive patterns

Strategy: validation

Validate before calling

if (opts.cloudRunUrl && opts.serviceName) {
  throw new Error('Pass only one of cloudRunUrl or serviceName');
}
await getCloudrunEndpoint(opts);

Type guard

const isMutuallyExclusive = (i) =>
  !(i.cloudRunUrl && i.serviceName);

Prevention

When it happens

Trigger: Calling getCloudrunEndpoint({cloudRunUrl: 'https://...', serviceName: 'remotion-...'}) where both are truthy.

Common situations: A config object that carries both a cached URL and the service name, or merging two option sources without deduplication.

Related errors


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