{"record":{"id":"46ce3ad02eaf4ee3","repo":"remotion-dev/remotion","slug":"serveurl-parameter-must-be-a-string-but-is-js","errorCode":null,"errorMessage":"\"serveURL\" parameter must be a string, but is ${JSON.stringify(serveUrl)}","messagePattern":"\"serveURL\" parameter must be a string, but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/cloudrun/src/shared/validate-serveurl.ts","lineNumber":5,"sourceCode":"import {getCloudStorageClient} from '../api/helpers/get-cloud-storage-client';\n\nexport const validateServeUrl = async (serveUrl: unknown) => {\n\tif (typeof serveUrl !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`\"serveURL\" parameter must be a string, but is ${JSON.stringify(\n\t\t\t\tserveUrl,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\t// if GCP Storage URL, validate that file exists\n\tif (serveUrl.startsWith('https://storage.googleapis.com')) {\n\t\tconst cloudStorageClient = getCloudStorageClient();\n\n\t\tconst bucketName = serveUrl.split('/')[3];\n\t\tconst fileName = serveUrl.split('/').slice(4).join('/');\n\t\tconst siteName = serveUrl.split('/')[5];\n\n\t\tconst [exists] = await cloudStorageClient\n\t\t\t.bucket(bucketName)\n\t\t\t.file(fileName)\n\t\t\t.exists();","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cloudrun/src/shared/validate-serveurl.ts#L1-L23","documentation":"Thrown by validateServeUrl() in @remotion/cloudrun when the serveUrl argument is not a string. The serveUrl points to the deployed Cloud Run serve bundle (often a Google Cloud Storage URL) that handles render requests, and the validator needs a string before it can inspect or fetch the URL.","triggerScenarios":"Calling renderMediaOnCloudRun (or a related API) with a serveUrl that is undefined, null, a number, an object, or an array. Common when the URL is read from an environment variable that was not set, or constructed conditionally and left undefined.","commonSituations":"Forgetting to set the SERVE_URL env var; reading from a config object with a typo'd key (returns undefined); passing the deployment object instead of its url property.","solutions":["Confirm the serveUrl variable is assigned and is a string before calling the API.","Check the env var / config key name for typos.","Pass the .url (or equivalent string field) of a deployment result, not the whole object."],"exampleFix":"// before\nrenderMediaOnCloudRun({ serveUrl: deployment, ... }); // deployment is an object\n\n// after\nrenderMediaOnCloudRun({ serveUrl: deployment.url, ... });","handlingStrategy":"type-guard","validationCode":"if (typeof serveUrl !== 'string' || serveUrl.length === 0) {\n  throw new TypeError('serveUrl must be a non-empty string');\n}","typeGuard":"const isServeUrl = (v: unknown): v is string =>\n  typeof v === 'string' && v.length > 0;","tryCatchPattern":null,"preventionTips":["Always set the SERVE_URL env var and read it into a typed string field.","Pass the .url returned by deploySite()/deployService(), not the whole object.","Fail fast in your own config loader if serveUrl is missing."],"tags":["cloudrun","validation","typescript","configuration"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}