🎥 Make videos programmatically with React
handle errors in stills
Jonny Burger65844627fe16
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.tsindex d590cf90d8..df2b7b2ec1 100644--- a/packages/cli/src/still.ts+++ b/packages/cli/src/still.ts@@ -10,7 +10,6 @@ import path from 'path';import {Config, Internals} from 'remotion';import {getCliOptions} from './get-cli-options';import {getCompositionId} from './get-composition-id';-import {handleCommonError} from './handle-common-errors';import {initializeRenderCli} from './initialize-render-cli';import {Log} from './log';import {parsedCli, quietFlagProvided} from './parse-command-line';diff --git a/packages/lambda/remotionlambda.zip b/packages/lambda/remotionlambda.zipindex 4ffb3f0186..2dd9562582 100644Binary files a/packages/lambda/remotionlambda.zip and b/packages/lambda/remotionlambda.zip differdiff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.tsindex 987705d50d..7372b4a7cc 100644--- a/packages/lambda/src/cli/commands/still.ts+++ b/packages/lambda/src/cli/commands/still.ts@@ -1,4 +1,5 @@import {CliInternals} from '@remotion/cli';+import {RenderInternals} from '@remotion/renderer';import {StillImageFormat} from 'remotion';import {downloadMedia} from '../../api/download-media';import {renderStillOnLambda} from '../../api/render-still-on-lambda';@@ -71,51 +72,65 @@ export const stillCommand = async (args: string[]) => {const privacy = parsedLambdaCli.privacy ?? DEFAULT_OUTPUT_PRIVACY;validatePrivacy(privacy);- const res = await renderStillOnLambda({- functionName,- serveUrl,- inputProps,- imageFormat: imageFormat as StillImageFormat,- composition,- privacy,- region: getAwsRegion(),- maxRetries,- envVariables,- frame: stillFrame,- quality,- logLevel,- outName: parsedLambdaCli['out-name'],- chromiumOptions,- timeoutInMilliseconds: puppeteerTimeout,- scale,- });-- Log.verbose(- CliInternals.chalk.gray(- `Bucket = ${res.bucketName}, renderId = ${res.renderId}, functionName = ${functionName}`- )- );- Log.verbose(- `CloudWatch logs (if enabled): ${getCloudwatchStreamUrl({+ try {+ const res = await renderStillOnLambda({functionName,+ serveUrl,+ inputProps,+ imageFormat: imageFormat as StillImageFormat,+ composition,+ privacy,region: getAwsRegion(),- renderId: res.renderId,- method: LambdaRoutines.still,- })}`- );+ maxRetries,+ envVariables,+ frame: stillFrame,+ quality,+ logLevel,+ outName: parsedLambdaCli['out-name'],+ chromiumOptions,+ timeoutInMilliseconds: puppeteerTimeout,+ scale,+ });+ Log.verbose(+ CliInternals.chalk.gray(+ `Bucket = ${res.bucketName}, renderId = ${res.renderId}, functionName = ${functionName}`+ )+ );+ Log.verbose(+ `CloudWatch logs (if enabled): ${getCloudwatchStreamUrl({+ functionName,+ region: getAwsRegion(),+ renderId: res.renderId,+ method: LambdaRoutines.still,+ })}`+ );- if (outName) {- Log.info('Finished rendering. Downloading...');- const {outputPath, sizeInBytes} = await downloadMedia({- bucketName: res.bucketName,- outPath: outName,- region: getAwsRegion(),- renderId: res.renderId,+ if (outName) {+ Log.info('Finished rendering. Downloading...');+ const {outputPath, sizeInBytes} = await downloadMedia({+ bucketName: res.bucketName,+ outPath: outName,+ region: getAwsRegion(),+ renderId: res.renderId,+ });+ Log.info('Done!', outputPath, formatBytes(sizeInBytes));+ } else {+ Log.info(`Finished still!`);+ Log.info();+ Log.info(res.url);+ }+ } catch (err) {+ const frames = RenderInternals.parseStack(+ ((err as Error).stack ?? '').split('\n')+ );++ const errorWithStackFrame = new RenderInternals.SymbolicateableError({+ message: (err as Error).message,+ frame: null,+ name: (err as Error).name,+ stack: (err as Error).stack,+ stackFrame: frames,});- Log.info('Done!', outputPath, formatBytes(sizeInBytes));- } else {- Log.info(`Finished still!`);- Log.info();- Log.info(res.url);+ await CliInternals.handleCommonError(errorWithStackFrame);}};