Edwin Ca Edwin Ca - 1 month ago 20
Node.js Question

Node.js S3-uploader issue

Trying to upload from node.js to Amazon S3 getting this error i spent all day to find an error no luck, image magic installed, app running on elastic beanstalk, previously installed on development server and code is working just fine when i move the application to aws its causing this error i checked all the dependencies its same as development server.

Node.js Log

Upload data:tmp/c0005d84e41ec82b4f5ae2b1cbf1c3b8
{ [Error: Command failed: /bin/sh -c identify -format "name=
size=%[size]
format=%m
colorspace=%[colorspace]
height=%[height]
width=%[width]
orientation=%[orientation]
" tmp/c0005d84e41ec82b4f5ae2b1cbf1c3b8
/bin/sh: identify: command not found
]
killed: false,
code: 127,
signal: null,
cmd: '/bin/sh -c identify -format "name=\nsize=%[size]\nformat=%m\ncolorspace=%[colorspace]\nheight=%[height]\nwidth=%[width]\norientation=%[orientation]\n" tmp/c0005d84e41ec82b4f5ae2b1cbf1c3b8' }


S3 upload options

var client = new upload('XXX', {

aws: {
path: 'images/',
region: 'us-east-1',
acl: 'public-read',
accessKeyId: 'XXX',
secretAccessKey: 'XXXX'
},

cleanup: {
versions: true,
original: false
},

original: {
awsImageAcl: 'private'
},

versions: [{
maxWidth: 1040,
format: 'jpg',
suffix: '-large',
quality: 80
},{
maxWidth: 780,
suffix: '-medium',
format: 'jpg',
quality: 80
}]
});


Upload Script

app.post('/profile/upload', mupload.single('avatar'), function (req, res, next) {


var data = req.file;
console.log("Upload data:" + data.path);

client.upload(data.path, {}, function(err, versions, meta) {
console.log(err);
console.log(meta);
console.log("versions data:" + versions);
versions.forEach(function(image) {
res.end(image.url);
});


});


});

Answer

this is your problem: /bin/sh: identify: command not found

the program identify is not installed, you need to install imagemagick on the EB instance. In your .ebextensions/packages.config add

packages:
  yum:
    ImageMagick: []
Comments