ImageMagick after execution environment update
Is ImageMagick binary no longer included in the new execution environment or the Node.js 10.x runtime?
Current working environment: Node.js 6.10
Fails to work when a development alias is updated (times out at 60 seconds), but works again when the delay layer is added.
The same code bundle on a new deployment using Node.js 10.x runtime displays the message:
"Could not execute GraphicsMagick/ImageMagick: convert [COMMAND ARGS] this most likely means the gm/convert binaries can't be found"
I'm using the NPM package gm v1.23.1. Snippet below:
const gm = require('gm').subClass({ imageMagick: true })
let writeStream = fs.createWriteStream(pdfFile)
let convert = gm().command('convert')
for(let page of pages)
convert.in(page)
convert.stream('pdf', (err, stdout, stderr) => {
stdout.pipe(writeStream)
})
Edited by: aku-sch on Jul 1, 2019 5:07 PM
Hi,
ImageMagick is no longer bundled with the Node.js 10.x runtime. There are two options to get ImageMagick working with your Node.js 10.x function:
1) Package the dependency and include it in your uploaded ZIP file
or
2) Create or use a Lambda Layer that includes ImageMagick
Cheers,
Kevin
Hi
I am new to all this Node stuff, what do you mean by "Package the dependency and include it in your uploaded ZIP file"? how can I do that? I am trying to use Node 10.x for image conversions using AWS Lambda. Please help!
Thanks
This may be of assistance
I ended up going through the process myself and it does indeed work.
To save you some time here's a zip file you can use to create a Lambda Layer.
https://connorb-share.s3.eu-west-2.amazonaws.com/image-magick.zip
When you create the layer make sure you add Node.js 10.x as a supported runtime. You can then set your function to use the latest Node.js 10.x and add the layer you created. The image conversion should then work again!
Edited by: connorB09b on Oct 20, 2019 5:20 AM
Hi
Many thanks for this resource. We faced similar issue and used the zip file you provided and it worked. Can you please explain the process in creating the zip. We still have some issues with respect to image color and want to further investigate.
Thanks
@connorB09b Thank you for posting your zip file, Connor!
Unfortunately, after we uploaded it as a new Lambda layer on our aws-lambda-image, it still didn't work for us.
This worked fine with NodeJS 8.10, but since we've been forced to upgrade (to either NodeJS 10.x or 12.x), it's not working even with the zip file.
I am familiar with layers, and I think i followed the instructions correctly. Can you think of anything further i need to do?
The Lambda is running in us-east-1 if that makes any difference.
Thanks!
Relevant questions
NodeJS Elasticbeanstalk Worker environment fails with `You didn't specify a Node.js version in the 'package.json'`
asked 5 months agoEnvironment named xxxxxx is in an invalid state for this operation.
asked 3 years agoCan't update environment variables in elastic beanstalk environment
asked 4 months agoHow do I access Lambda environment variables in IoT Greengrass?
Accepted Answerasked 2 years agoRestart MWAA environment programmatically
asked 9 months agoModify Auto Scaling Health Check setting for Elastic Beanstalk Enviornment
asked 3 months agoAWS ElasticBeanstalk NodeJS Application version cannot be uploaded/deployed/reverted "Unable to create the application version:" / "Validation error"
asked 4 months agoImageMagick after execution environment update
asked 3 years agoEB instance Degraded after Platform update
asked 2 years agoRecent update to Code Deploy now breaking build (we made no changes)
asked a year ago