🎥 Make videos programmatically with React
give better error message when experiencing unhandled error
Jonny Burger2e12679f7c83
diff --git a/packages/lambda/src/shared/call-lambda.ts b/packages/lambda/src/shared/call-lambda.tsindex ed62c36dc1..948176e3c3 100644--- a/packages/lambda/src/shared/call-lambda.ts+++ b/packages/lambda/src/shared/call-lambda.ts@@ -56,8 +56,15 @@ export const callLambda = async <T extends LambdaRoutines>({if (event.InvokeComplete) {if (event.InvokeComplete.ErrorCode) {+ const logs = `https://${region}.console.aws.amazon.com/cloudwatch/home?region=${region}#logsV2:logs-insights$3FqueryDetail$3D~(end~0~start~-3600~timeType~'RELATIVE~unit~'seconds~editorString~'fields*20*40timestamp*2c*20*40requestId*2c*20*40message*0a*7c*20filter*20*40requestId*20like*20*${res.$metadata.requestId}*22*0a*7c*20sort*20*40timestamp*20asc~source~(~'*2faws*2flambda*2f${functionName}))`;+ if (event.InvokeComplete.ErrorCode === 'Unhandled') {+ throw new Error(+ `Lambda function ${functionName} failed with an unhandled error. See ${logs} to see the logs of this invocation.`+ );+ }+throw new Error(- `Lambda function ${functionName} failed with error code ${event.InvokeComplete.ErrorCode}: ${event.InvokeComplete.ErrorDetails}`+ `Lambda function ${functionName} failed with error code ${event.InvokeComplete.ErrorCode}: ${event.InvokeComplete.ErrorDetails}. See ${logs} to see the logs of this invocation.`);}}