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.
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.
",
"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)"
]
}
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
}
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.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…