remotion-dev/remotion · error · TypeError

"serveURL" parameter must be a string, but is ${JSON.stringi

Error message

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

What it means

Thrown by validateServeUrl() in @remotion/lambda-client when the serveUrl argument passed to renderMediaOnLambda() / getCompositionsOnLambda() / deploySite() is not a string. serveUrl identifies the deployed Remotion Serve (either a URL or an S3 subfolder name), and the rest of the pipeline assumes a string.

Source

Thrown at packages/lambda-client/src/validate-serveurl.ts:3

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

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. If you hold a URL object, pass serveUrl.toString() (or href).
  2. Ensure the variable you pass is actually a string by checking typeof before the call.
  3. If the value comes from a config, serialize/cast it to a string at the boundary.

Example fix

// before
const serveUrl = new URL('https://remotionlambda-abc.s3.amazonaws.com/sites/test');
await renderMediaOnLambda({serveUrl, ...});

// after
const serveUrl = new URL('https://remotionlambda-abc.s3.amazonaws.com/sites/test').toString();
await renderMediaOnLambda({serveUrl, ...});
Defensive patterns

Strategy: type-guard

Validate before calling

const serveUrl = typeof input === 'object' && input !== null && 'href' in input ? String(input.href) : String(input);
await renderMediaOnLambda({serveUrl, ...});

Type guard

const isServeUrl = (v: unknown): v is string => typeof v === 'string';

Prevention

When it happens

Trigger: Passing serveUrl as a URL object (new URL(...)), a number, undefined, null, or an object. The check is purely on typeof === 'string'.

Common situations: Constructing a URL with the browser/Node URL class and forgetting to .toString(); reading serveUrl from a config that returned an object; passing the result of an async call that resolved to an object instead of a string.

Related errors


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