AWS Lambda不与gm模块一起使用 [英] AWS Lambda not working along with the gm module

查看:199
本文介绍了AWS Lambda不与gm模块一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 AWS Lambda 调整我的图片大小使用节点js s3 bucket 进入不同大小的变体放入 s3 bucket

I am using AWS Lambda to resize my image in s3 bucket into different size variants using node js when an image is put into the s3 bucket.

它一直工作到昨天。今天当我使用相同的lambda函数时,我收到以下错误:

It was working till yesterday. Today when I use the same lambda function I get the following error:

{
"errorMessage": "Command failed: identify: not authorized `//bucketname.s3.amazonaws.com/imagename.jpg' @ error/constitute.c/ReadImage/454.\n",
"errorType": "Error",
"stackTrace": [
    "",
    "ChildProcess.proc.on.onExit (/var/task/node_modules/gm/lib/command.js:297:17)",
    "emitTwo (events.js:87:13)",
    "ChildProcess.emit (events.js:172:7)",
    "maybeClose (internal/child_process.js:821:16)",
    "Socket.<anonymous> (internal/child_process.js:319:11)",
    "emitOne (events.js:77:13)",
    "Socket.emit (events.js:169:7)",
    "Pipe._onclose (net.js:469:12)"
    ]
}

我无法理解为什么会出现这种现象。以下我的lambda函数的所有给定函数都在异步瀑布中,首先计算宽高比,然后转换为将图像分成不同大小的变体。

I am unable to understand why this phenomenon occurred. All the given functions of my lambda function below are in async waterfall to first compute the aspect ratio and then convert the image into different size variants.

var request=require("request");

function getTheAspectRatio(callback) {
    gm(s3Url) // I am constructing the image url in the AWS Lambda Function.
        .size(function(err, size) {
            if (!err) {
                //Calculate the Aspect ratio
            } else if (err) {
                //Give Back the Error
              }
        });
}

function getTheImageBuffer(callback) {
    request(imageUrl, function(err, res, res1) {
        if (err) {
            callback(err);
        } else {
            buffer = res1;
            console.log("got the BUffer");
            callback(null);
        }

    });
}

function convertToThumbNail(callback) {
    //Convert to Thumbnail Image
}


function convertToFull(callback) {
    //Convert to Full Image
}

function convertToBadge(callback) {
   //Convert to Badge image

}

有人可以帮忙调试问题吗?过去3个小时我对此很感兴趣。我的AWS Lambda在东京地区。

Can somebody help in debugging the issue? I am kind of stuck on this for the past 3 hours.My AWS Lambda is in Tokyo Region.

推荐答案

我在过去5周一直运行良好的进程中发生完全相同的错误消息。在今天与AWS支持人员交谈后,我被告知,由于最近在此处记录的漏洞 https://,已从AWS Lambda中删除了对Imagemagick的本机库支持imagetragick.com/

I had the exact same error message occur on a process that had been running flawlessly for the last 5 weeks. After speaking with AWS support today, I was informed that native library support for Imagemagick was removed from AWS Lambda due to the vulnerability that was found recently documented here https://imagetragick.com/.

我被告知我必须重建我的Lambda函数并捆绑在我自己的本机库版本中 - https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/

I was told I would have to rebuild my Lambda function and bundle in my own version of the native library - https://aws.amazon.com/blogs/compute/nodejs-packages-in-lambda/

支持代表确认没有公布这一变化。

The support representative confirmed that there had not been a public announcement of this change.

TLDR:如果您使用的是依赖于Imagemagick版本捆绑的AWS Lambda函数,截至05/04/2016,它现在已损坏,在您使用自己的构建和维护版本的库进行重新部署之前可能无法运行。愿第四个和你在一起......

TLDR: If you had been using an AWS Lambda function that was dependent on the bundled in version of Imagemagick, as of 05/04/2016, it is now broken and probably will not work until you redeploy with your own built and maintained version of the library. May the fourth be with you...

这篇关于AWS Lambda不与gm模块一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆