简体   繁体   中英

AWS Lambda - Create Thumbnail

I am using AWS Lambda for creating resized thumbnails. The source is an S3 bucket and the destination is another S3 bucket. I was able to create the lambda function from Amazon CLI. The function is triggered whenever a new image is added to the source bucket. But, the resize/thumbnail creation is not working. I can see some issue in the CloudWatch Console.

The content of the uploaded ZIP package is:

CreateThumbnail.js, node_modules


Unable to import module 'CreateThumbnail': Error
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/task/CreateThumbnail.js:2:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

Best regards, BP

Finally able to find the source of the bug. The command used to make the zip file was causing the issue.

The correct command is: zip -r CreateThumbnail.zip *

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM