{"record":{"id":"d4e8e6d3dfbe9964","repo":"remotion-dev/remotion","slug":"either-cloudrunurl-or-servicename-must-be-provided","errorCode":null,"errorMessage":"Either cloudRunUrl or serviceName must be provided","messagePattern":"Either cloudRunUrl or serviceName must be provided","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cloudrun/src/api/helpers/get-cloudrun-endpoint.ts","lineNumber":18,"sourceCode":"import {validateCloudRunUrl} from '../../shared/validate-cloudrun-url';\nimport {validateRegion} from '../../shared/validate-region';\nimport {validateServiceName} from '../../shared/validate-service-name';\nimport {getServiceInfo} from '../get-service-info';\n\nexport type getCloudrunEndpointInput = {\n\tcloudRunUrl?: string | null;\n\tserviceName?: string | null;\n\tregion?: string;\n};\n\nexport const getCloudrunEndpoint = async ({\n\tcloudRunUrl,\n\tserviceName,\n\tregion,\n}: getCloudrunEndpointInput): Promise<string> => {\n\tif (!cloudRunUrl && !serviceName)\n\t\tthrow new Error('Either cloudRunUrl or serviceName must be provided');\n\tif (cloudRunUrl && serviceName)\n\t\tthrow new Error(\n\t\t\t'Either cloudRunUrl or serviceName must be provided, not both',\n\t\t);\n\n\tlet cloudRunEndpoint = '';\n\tif (cloudRunUrl) {\n\t\tvalidateCloudRunUrl(cloudRunUrl);\n\t\tcloudRunEndpoint = cloudRunUrl;\n\t}\n\n\tif (serviceName) {\n\t\tif (!region)\n\t\t\tthrow new Error(\n\t\t\t\t'If determining Cloudrun Url from serviceName, region must be provided',\n\t\t\t);\n\t\tvalidateServiceName(serviceName);\n\t\tconst validatedRegion = validateRegion(region);","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/cloudrun/src/api/helpers/get-cloudrun-endpoint.ts#L1-L36","documentation":"Thrown by getCloudrunEndpoint() when both cloudRunUrl and serviceName are null/undefined. Exactly one of the two must be supplied so the function can resolve the render endpoint URL.","triggerScenarios":"Calling getCloudrunEndpoint({}) or getCloudrunEndpoint({cloudRunUrl: null, serviceName: null}) — i.e., omitting both identifying fields.","commonSituations":"Building render options programmatically where both fields are conditionally set and neither ends up populated, or destructuring a config object that lacks both keys.","solutions":["Provide either cloudRunUrl (the HTTPS endpoint of a deployed Cloud Run service) or serviceName (the deployed service name).","Validate the input object has exactly one of the two keys before calling."],"exampleFix":"// before\nawait getCloudrunEndpoint({region: 'us-central1'});\n// after\nawait getCloudrunEndpoint({serviceName: 'remotion-4.0.0-mem2', region: 'us-central1'});","handlingStrategy":"validation","validationCode":"const hasUrl = !!opts.cloudRunUrl;\nconst hasName = !!opts.serviceName;\nif (!hasUrl && !hasName) {\n  throw new Error('Provide either cloudRunUrl or serviceName');\n}\nawait getCloudrunEndpoint(opts);","typeGuard":"type EndpointInput = {cloudRunUrl: string; serviceName?: null} | {serviceName: string; region: string; cloudRunUrl?: null};\nconst isValidEndpointInput = (i): i is EndpointInput =>\n  (!!i.cloudRunUrl && !i.serviceName) || (!!i.serviceName && !!i.region && !i.cloudRunUrl);","tryCatchPattern":null,"preventionTips":["Use a discriminated union type for endpoint inputs to enforce exactly-one at compile time."],"tags":["cloudrun","gcp","validation","endpoint"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}