By using AWS re:Post, you agree to the Terms of Use

S3 trigger to create thumbnail Tutorial doesn´t work, responds 202 but doesn´t do the job


I have been asked to complete tutorial from here: I go step by step, and on 7th step when i invoke the function I get

$ aws lambda invoke --function-name CreateThumbnail --cli-binary-format raw-in-base64-out     --invocation-type Event       --payload file://inputFile.txt outputfile.txt
    "StatusCode": 202

Function supose to create thumbnail in one bucket from the image from another one but it does nothing.

The only differences i do are:

  1. when running aws --version i get

aws-cli/2.7.18 Python/3.9.11 Windows/10 exe/AMD64 prompt/off instead of aws-cli/2.0.57 Python/3.7.4 Darwin/19.6.0 exe/x86_64

  1. I cannot run zip command so i pack in manually into, i tired both: to pack whole folder and content inside only

  2. In the inputFile.txt i tried to change sourcebucket and key only as they asking, than i tried as well with changing etag

  3. I try to complete step 8 and 9 anyway but it doesn´t trigger anything

How can I accomplish this task?
Output file is being created but it´s completely empty, i cannot check the function in the AWS console because it says it´s too big.

asked 23 days ago32 views
1 Answers
Accepted Answer

Check the Lambda function logs in CloudWatch and look for error messages. If the error is due to sharp module, then there might be a compatibility issue with the operating system used to build the package. One way to get around this issue is to create a Lambda Layer for the sharp module and then reference that in your Lambda function.

Here's another tutorial you can follow to create a Lambda Layer for sharp:

profile picture
answered 23 days ago
  • Sharp module incompatibility was the case, I develop on windows I simply installed linux version of sharp running npm install --arch=x64 --platform=linux sharp instead of npm install sharp And It worked Thank you

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions