remotion-dev/remotion · error · TypeError

"serviceName" parameter must be a string, but is ${JSON.stri

Error message

"serviceName" parameter must be a string, but is ${JSON.stringify(serviceName)}

What it means

Thrown by validateServiceName() in @remotion/cloudrun when the serviceName argument is not a string. The service name identifies the Google Cloud Run service to invoke, so the validator rejects any non-string before it is used to construct a request.

Source

Thrown at packages/cloudrun/src/shared/validate-service-name.ts:3

export const validateServiceName = (serviceName: unknown) => {
	if (typeof serviceName !== 'string') {
		throw new TypeError(
			`"serviceName" parameter must be a string, but is ${JSON.stringify(
				serviceName,
			)}`,
		);
	}
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure the serviceName variable is a non-empty string before the call.
  2. Use the name returned by deployService() rather than hardcoding or deriving it incorrectly.
  3. Check env var / config key names for typos.

Example fix

// before
renderMediaOnCloudRun({ serviceName: deployment, ... });

// after
renderMediaOnCloudRun({ serviceName: deployment.name, ... });
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof serviceName !== 'string' || serviceName.length === 0) {
  throw new TypeError('serviceName must be a non-empty string');
}

Type guard

const isServiceName = (v: unknown): v is string =>
  typeof v === 'string' && v.length > 0;

Prevention

When it happens

Trigger: Calling a Cloud Run API that takes a serviceName with a value that is undefined, null, a number, or an object. Typically happens when the name is read from an unset env var or pulled from a config with a missing key.

Common situations: Forgetting to set the service name env var; destructuring a deploy result and passing the wrong field (e.g. the whole object instead of its name); typo in the config key.

Related errors


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