Skip to content

🎥 Make videos programmatically with React

handle null

Jonny Burgerea085f594589
diff --git a/packages/lambda/src/shared/call-lambda.ts b/packages/lambda/src/shared/call-lambda.ts
index c2e4535a32..034573cc40 100644
--- a/packages/lambda/src/shared/call-lambda.ts
+++ b/packages/lambda/src/shared/call-lambda.ts
@@ -31,7 +31,12 @@ export const callLambda = async <T extends LambdaRoutines>({
errorMessage: string;
trace: string[];
};
- if (json && 'errorMessage' in json) {
+
+ if (json === null) {
+ throw new Error('Lambda function unexpectedly returned null');
+ }
+
+ if ('errorMessage' in json) {
const err = new Error(json.errorMessage);
err.name = json.errorType;
err.stack = (json.trace ?? []).join('\n');