Skip to content

Commit 3936b6a

Browse files
snobleclaude
andcommitted
fix: check Lambda execution errors in S3 uploader
The upload function now properly checks the result of lambda.send() and throws an exception when the Lambda execution fails. This ensures that errors from the batch processor are properly propagated up the call stack. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 63d962f commit 3936b6a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/sst/support/custom-resources/s3-uploader.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async function uploadFiles(props: Props) {
7777
fileOptions,
7878
replaceValues,
7979
} = props;
80-
await Promise.all(
80+
const results = await Promise.all(
8181
sources.map((source) =>
8282
lambda.send(
8383
new InvokeCommand({
@@ -96,6 +96,14 @@ async function uploadFiles(props: Props) {
9696
)
9797
)
9898
);
99+
100+
// Check for Lambda execution errors
101+
results.forEach((result) => {
102+
if (result.FunctionError) {
103+
const payload = result.Payload ? new TextDecoder().decode(result.Payload) : 'Unknown error';
104+
throw new Error(`Lambda execution failed: ${result.FunctionError}. Details: ${payload}`);
105+
}
106+
});
99107
}
100108

101109
async function purgeOldFiles(props: Props) {

0 commit comments

Comments
 (0)