{"record":{"id":"7b3fdb9519d5d1a6","repo":"remotion-dev/remotion","slug":"cloudrunurl-parameter-must-be-a-string-but-is","errorCode":null,"errorMessage":"\"cloudRunUrl\" parameter must be a string, but is ${JSON.stringify(cloudRunUrl)}","messagePattern":"\"cloudRunUrl\" parameter must be a string, but is (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/cloudrun/src/shared/validate-cloudrun-url.ts","lineNumber":3,"sourceCode":"export const validateCloudRunUrl = (cloudRunUrl: unknown) => {\n\tif (typeof cloudRunUrl !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`\"cloudRunUrl\" parameter must be a string, but is ${JSON.stringify(\n\t\t\t\tcloudRunUrl,\n\t\t\t)}`,\n\t\t);\n\t}\n};\n\n// To improve this, we could add an endpoint within the image that returns some message to confirm that this is a Cloud Run url\n","sourceCodeStart":1,"sourceCodeEnd":12,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cloudrun/src/shared/validate-cloudrun-url.ts#L1-L12","documentation":"Thrown by validateCloudRunUrl() when cloudRunUrl is not a string. The validator is intentionally minimal — it only checks the type, not the URL shape (the comment notes a future endpoint check). It exists to fail fast before the URL is used to invoke the Cloud Run service.","triggerScenarios":"Passing a non-string cloudRunUrl (undefined, null, object, number) to deployService(), renderMediaOnCloudRun(), or any API that validates the service URL.","commonSituations":"Reading the URL from an unset env var; passing a service object instead of its .uri string; deserializing config from JSON where the field is missing.","solutions":["Ensure cloudRunUrl is a string before calling the API.","Read the deployed service's URL from the deploy result object and store it explicitly.","Add a startup check that the env var (e.g., REMOTION_CLOUDRUN_URL) is set."],"exampleFix":"// before\nconst { serviceUrl } = config; // undefined when missing\nawait renderMediaOnCloudRun({ cloudRunUrl: serviceUrl, ... });\n// after\nconst cloudRunUrl = config.serviceUrl;\nif (typeof cloudRunUrl !== 'string') throw new Error('cloudRunUrl missing in config');\nawait renderMediaOnCloudRun({ cloudRunUrl, ... });","handlingStrategy":"type-guard","validationCode":"import { validateCloudRunUrl } from '@remotion/cloudrun/shared';\nvalidateCloudRunUrl(cloudRunUrl);","typeGuard":"function isCloudRunUrlString(v: unknown): v is string {\n  return typeof v === 'string';\n}","tryCatchPattern":"if (typeof cloudRunUrl !== 'string') throw new TypeError('cloudRunUrl must be a string');","preventionTips":["Store the deployed service URL immediately from the deploy result.","Assert env vars are set at process start.","Avoid deriving the URL from untyped JSON without a type check."],"tags":["cloudrun","validation","typescript","url"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}