aws-samples / image-optimization

Simple, performant and cost efficient solution for optimizing images using Amazon CloudFront, Amazon S3 and AWS Lambda
MIT No Attribution
172 stars 106 forks source link

"Error downloading original image" after configuring to my s3 bucket #8

Closed t6inGtHb closed 1 year ago

t6inGtHb commented 1 year ago
  1. I have successfully deployed using CDK using the sample S3 bucket, by following this doc However, after I ran cdk deploy -c S3_IMAGE_BUCKET_NAME='tina-test-image-trans-cloudfront-1', I'm getting an "error downloading original image" when accessing transformed URL: https://d171s5ttralwpv.cloudfront.net/images/iphone.jpg?format=auto&width=300 Here tina-test-image-trans-cloudfront-1 is my own s3 bucket with an image iphone.jpg in it. The output of cdk deploy -c S3_IMAGE_BUCKET_NAME='tina-test-image-trans-cloudfront-1' is green and it displays the ImageDeliveryDomain and OriginalImagesS3Bucket in the outputs. Is there anything wrong? Should I try to run cdk destroy first to stop the sample s3 bucket before switching to my own s3 bucket?
  2. Is there a way I can specify multiple s3 buckets?
achrafsouk commented 1 year ago

Hello!

  1. Can you provide the Lambda logs to better understand the issue? I suspect that it's a mismatch in the image path. Did you upload the image to a folder called images? This is how you refer to this image in the URL you shared.
  2. Yes, but you need to modify the cdk / lambda code for this. In your code changes, you need to instruct CloudFront and the Lambda, which bucket to use for a specific image.
t6inGtHb commented 1 year ago

Thank you! I have actually successfully got the image optimization working yesterday, and the issue is indeed the mismatch in the image path. There isn't a folder called "images" -- I thought it was a pattern for image optimization service. Removing the images folder works for me. But to understand it better, how do I collect the Lambda logs? Is it something inside "Developer Tools"?

achrafsouk commented 1 year ago

Ah cool, this is what I suspected.

For the logs, go to Lambda page in the AWS console, select the region where you deployed the cdk, and then click on monitoring then view logs in CloudWatch Logs.