Skip to content

🎥 Make videos programmatically with React

only write to lambda once actually saved

Jonny Burger50960dffb01e
diff --git a/packages/lambda/src/functions/helpers/write-lambda-error.ts b/packages/lambda/src/functions/helpers/write-lambda-error.ts
index 4f5d3a30ed..db04989c89 100644
--- a/packages/lambda/src/functions/helpers/write-lambda-error.ts
+++ b/packages/lambda/src/functions/helpers/write-lambda-error.ts
@@ -3,7 +3,7 @@ import {getFolderFiles} from './get-files-in-folder';
import {errorIsOutOfSpaceError} from './is-enosp-err';
export type LambdaErrorInfo = {
- type: 'renderer' | 'browser' | 'stitcher' | 'webhook';
+ type: 'renderer' | 'browser' | 'stitcher' | 'webhook' | 'artifact';
message: string;
name: string;
stack: string;
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 4b4f2bde32..62d73e407e 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -367,12 +367,6 @@ const innerLaunchHandler = async ({
const region = getCurrentRegionInFunction();
const s3Key = artifactName(renderMetadata.renderId, artifact.filename);
- overallProgress.addReceivedArtifact({
- filename: artifact.filename,
- sizeInBytes: artifact.content.length,
- s3Url: `https://s3.${region}.amazonaws.com/${renderBucketName}/${s3Key}`,
- s3Key,
- });
const start = Date.now();
RenderInternals.Log.info(
@@ -394,9 +388,28 @@ const innerLaunchHandler = async ({
{indent: false, logLevel: params.logLevel},
`Wrote artifact to S3 in ${Date.now() - start}ms`,
);
+ overallProgress.addReceivedArtifact({
+ filename: artifact.filename,
+ sizeInBytes: artifact.content.length,
+ s3Url: `https://s3.${region}.amazonaws.com/${renderBucketName}/${s3Key}`,
+ s3Key,
+ });
})
.catch((err) => {
- // TODO: Handle error
+ overallProgress.addErrorWithoutUpload({
+ type: 'artifact',
+ message: (err as Error).message,
+ name: (err as Error).name as string,
+ stack: (err as Error).stack as string,
+ tmpDir: null,
+ frame: artifact.frame,
+ chunk: null,
+ isFatal: false,
+ attempt: 1,
+ willRetry: false,
+ totalAttempts: 1,
+ });
+ overallProgress.upload();
RenderInternals.Log.error(
{indent: false, logLevel: params.logLevel},
'Failed to write artifact to S3',
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index 95f07a44ca..49c9d7aeb4 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -238,7 +238,6 @@ const innerStillHandler = async ({
);
})
.catch((err) => {
- // TODO: Handle error
RenderInternals.Log.error(
{indent: false, logLevel: lambdaParams.logLevel},
'Failed to write artifact to S3',
@@ -402,7 +401,7 @@ export const stillHandler = async (
message: (err as Error).message as string,
stack: (err as Error).stack as string,
chunk: null,
- frame: null,
+ frame: params.frame,
type: 'renderer',
isFatal: false,
tmpDir: getTmpDirStateIfENoSp((err as Error).stack as string),