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.

posta 2 anni fa222 visualizzazioni
1 Risposta
2
Risposta accettata

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
con risposta 2 anni fa
  • 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

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande