Skip to content

🎥 Make videos programmatically with React

same validation for cloud run

Jonny Burger10e89ab0eaaf
diff --git a/packages/cloudrun/src/cli/commands/render/index.ts b/packages/cloudrun/src/cli/commands/render/index.ts
index 95282f4bd6..afea5f085a 100644
--- a/packages/cloudrun/src/cli/commands/render/index.ts
+++ b/packages/cloudrun/src/cli/commands/render/index.ts
@@ -72,6 +72,12 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {
validateServeUrl(serveUrl);
+ if (!serveUrl.startsWith('https://') && !serveUrl.startsWith('http://')) {
+ throw Error(
+ 'Passing the shorthand serve URL without composition name is currently not supported.\n Make sure to pass a composition name after the shorthand serve URL or pass the complete serveURL without composition name to get to choose between all compositions.'
+ );
+ }
+
const server = RenderInternals.prepareServer({
concurrency: 1,
indent: false,
diff --git a/packages/cloudrun/src/cli/commands/still.ts b/packages/cloudrun/src/cli/commands/still.ts
index d566f5e6aa..ec12d66b67 100644
--- a/packages/cloudrun/src/cli/commands/still.ts
+++ b/packages/cloudrun/src/cli/commands/still.ts
@@ -45,6 +45,13 @@ export const stillCommand = async (args: string[], remotionRoot: string) => {
Log.info('No compositions passed. Fetching compositions...');
validateServeUrl(serveUrl);
+
+ if (!serveUrl.startsWith('https://') && !serveUrl.startsWith('http://')) {
+ throw Error(
+ 'Passing the shorthand serve URL without composition name is currently not supported.\n Make sure to pass a composition name after the shorthand serve URL or pass the complete serveURL without composition name to get to choose between all compositions.'
+ );
+ }
+
const server = RenderInternals.prepareServer({
concurrency: 1,
indent: false,
diff --git a/packages/cloudrun/src/shared/validate-serveurl.ts b/packages/cloudrun/src/shared/validate-serveurl.ts
index b609ea24d6..83a1acbb48 100644
--- a/packages/cloudrun/src/shared/validate-serveurl.ts
+++ b/packages/cloudrun/src/shared/validate-serveurl.ts
@@ -24,13 +24,7 @@ export const validateServeUrl = async (serveUrl: unknown) => {
if (!exists) {
throw new Error(
- 'serveURL ERROR. File "' +
- fileName +
- '" not found in bucket "' +
- bucketName +
- '". Is your site name correct - "' +
- siteName +
- '"?'
+ `serveURL ERROR. File "${fileName}" not found in bucket "${bucketName}". Is your site name correct - "${siteName}"?`
);
}
}