Skip to content

🎥 Make videos programmatically with React

different error for lambda and non lambda

Jonny Burger9f89fd978566
diff --git a/packages/cli/src/determine-image-format.ts b/packages/cli/src/determine-image-format.ts
index 23c583fb41..63877a1c69 100644
--- a/packages/cli/src/determine-image-format.ts
+++ b/packages/cli/src/determine-image-format.ts
@@ -23,22 +23,26 @@ export const determineFinalImageFormat = ({
outName,
configImageFormat,
cliFlag,
+ isLambda,
}: {
downloadName: string | null;
outName: string | null;
configImageFormat: ImageFormat | null;
cliFlag: ImageFormat | null;
+ isLambda: boolean;
}): {format: StillImageFormat; source: string} => {
const outNameExtension = deriveExtensionFromFilename(outName);
const downloadNameExtension = deriveExtensionFromFilename(downloadName);
+ const outNameDescription = isLambda ? 'S3 output key' : 'out name';
+
if (
outNameExtension &&
downloadNameExtension &&
outNameExtension !== downloadNameExtension
) {
throw new TypeError(
- `Image format mismatch: ${outName} was given as the S3 output name and ${downloadName} was given as the download name, but the extensions don't match.`
+ `Image format mismatch: ${outName} was given as the ${outNameDescription} and ${downloadName} was given as the download name, but the extensions don't match.`
);
}
@@ -55,7 +59,7 @@ export const determineFinalImageFormat = ({
if (outNameExtension) {
if (cliFlag && outNameExtension !== cliFlag) {
throw new TypeError(
- `Image format mismatch: ${outName} was given as the S3 out name, but --image-format=${cliFlag} was passed. The image formats must match.`
+ `Image format mismatch: ${outName} was given as the ${outNameDescription}, but --image-format=${cliFlag} was passed. The image formats must match.`
);
}
diff --git a/packages/cli/src/index.tsx b/packages/cli/src/index.tsx
index da1b90ffa6..ac0bd8cc3a 100644
--- a/packages/cli/src/index.tsx
+++ b/packages/cli/src/index.tsx
@@ -27,7 +27,6 @@ import {createOverwriteableCliOutput} from './progress-bar';
import {render} from './render';
import {still} from './still';
import {upgrade} from './upgrade';
-import {validateImageFormat} from './validate-image-format';
import {
validateVersionsBeforeCommand,
versionsCommand,
@@ -100,7 +99,6 @@ export const CliInternals = {
getCliOptions,
parseCommandLine,
loadConfig,
- validateImageFormat,
initializeCli,
BooleanFlags,
quietFlagProvided,
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index b4e8351310..b353e806f9 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -29,7 +29,6 @@ import {
getOutputLocation,
getUserPassedOutputLocation,
} from './user-passed-output-location';
-import {validateImageFormat} from './validate-image-format';
export const still = async (remotionRoot: string) => {
const startTime = Date.now();
@@ -75,6 +74,7 @@ export const still = async (remotionRoot: string) => {
configImageFormat: ConfigInternals.getUserPreferredImageFormat() ?? null,
downloadName: null,
outName: getUserPassedOutputLocation(),
+ isLambda: false,
});
const relativeOutputLocation = getOutputLocation({
@@ -93,8 +93,6 @@ export const still = async (remotionRoot: string) => {
)
);
- validateImageFormat(imageFormat, absoluteOutputLocation);
-
const browserInstance = openBrowser(browser, {
browserExecutable,
chromiumOptions,
diff --git a/packages/cli/src/validate-image-format.ts b/packages/cli/src/validate-image-format.ts
deleted file mode 100644
index bf552a59c8..0000000000
--- a/packages/cli/src/validate-image-format.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-import type {ImageFormat} from '@remotion/renderer';
-import {Log} from './log';
-
-export const validateImageFormat = (
- imageFormat: ImageFormat,
- outName: string | null
-) => {
- if (imageFormat === 'png' && !outName?.endsWith('.png')) {
- Log.warn(`Rendering a PNG, expected a .png extension but got ${outName}`);
- }
-
- if (
- imageFormat === 'jpeg' &&
- !outName?.endsWith('.jpg') &&
- !outName?.endsWith('.jpeg')
- ) {
- Log.warn(
- `Rendering a JPEG, expected a .jpg or .jpeg extension but got ${outName}`
- );
- }
-};
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index eb7b35be24..838679c862 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -75,6 +75,7 @@ export const stillCommand = async (args: string[]) => {
outName: outName ?? null,
configImageFormat: ConfigInternals.getUserPreferredImageFormat() ?? null,
cliFlag: CliInternals.parsedCli['image-format'] ?? null,
+ isLambda: true,
});
try {