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

0

I have been asked to complete tutorial from here: https://docs.aws.amazon.com/lambda/latest/dg/with-s3-tutorial.html 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

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

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

  4. 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.

질문됨 2년 전222회 조회
1개 답변
2
수락된 답변

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: https://javascript.plainenglish.io/image-manipulation-with-sharp-aws-lambda-functions-layers-and-claudia-js-876d3dadcdb4

profile picture
joahna
답변함 2년 전
  • 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

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠