Skip to content

Conversation

@snoble
Copy link

@snoble snoble commented Jul 8, 2025

Summary

  • Modified the uploadFiles function in s3-uploader.ts to capture and check Lambda invocation results
  • Added error handling that throws an exception when FunctionError is present in the Lambda response
  • This ensures that Lambda execution failures are properly propagated to the caller

Context

The S3 uploader uses lambda.send() to invoke batch processors for file uploads. Previously, if the Lambda function failed during execution, the error was not caught because lambda.send() doesn't throw exceptions for Lambda execution failures - it only throws for client/network errors.

This change fixes the issue by:

  1. Storing the results of all Lambda invocations
  2. Checking each result for FunctionError property
  3. Throwing an informative error if any Lambda execution failed

Test plan

  • Verify that successful Lambda executions continue to work as before
  • Test that Lambda execution errors are now properly caught and thrown
  • Ensure error messages include helpful debugging information

🤖 Generated with Claude Code

@netlify
Copy link

netlify bot commented Jul 8, 2025

Deploy Preview for sst-docs canceled.

Name Link
🔨 Latest commit 7a24232
🔍 Latest deploy log https://app.netlify.com/projects/sst-docs/deploys/686d90d65be6af00088df6d1

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.

The error handling follows the same pattern as script-function/index.ts:
- Parses the error payload to extract errorType and errorMessage
- Includes the source bucket/key in the error for better debugging
- Uses the error.reason pattern consistent with the codebase

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@snoble snoble force-pushed the fix/lambda-send-error-handling branch from 3936b6a to 7a24232 Compare July 8, 2025 21:42
@snoble
Copy link
Author

snoble commented Jul 16, 2025

This fixes an issue that currently exists where a failed s3 uploaded will break your static site deploy. It seems to be a pretty critical bug for sst.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant