sample-serverless-image-resizer-s3-lambda
sample-serverless-image-resizer-s3-lambda copied to clipboard
Fix image resizing Lambda function - resolve variable errors and
Summary
Fixed critical bugs in the image resizing Lambda function that were preventing resized images from being created and displayed properly.
Issues Fixed
-
Variable name error: Fixed undefined
resized_pathvariable indownload_and_resizefunction (line 61) - Duplicate upload: Removed redundant upload operation that was happening twice
-
Missing parameter: Added
target_bucketparameter todownload_and_resizefunction - Poor error handling: Improved handling of non-image files to prevent unnecessary uploads
Testing
- Verified image files are properly resized and uploaded to the resized bucket
- Confirmed non-image files are skipped without attempting resize operations
- Tested that the web interface now correctly displays both original and resized images with proper file sizes
Before/After
Before: Resized images showed "(bytes)" without actual file sizes in the web interface After: Resized images display proper file sizes and are accessible via presigned URLs