gm icon indicating copy to clipboard operation
gm copied to clipboard

Permission denied for gm binaries installed within AWS Lambda

Open basimhennawi opened this issue 7 years ago • 3 comments

I'm using GraphicsMagick in my Lambda function (NodeJs 8.10) , for that I need to install both:

  • the NodeJs library for it gm (latest 1.23.1) [That's fine!]
  • and the GM binaries

To get the gm binaries on the Lambda, after some googling/stackingoverflow, get to create this github gist that states what I did briefly as follow:

  • Create EC2 instance with Amazon Linux AMI that matches AWS Lambda's runtime.
  • Install the gm there, tar it, copy it to my lambda, zipped it, packaged it, and deployed it.

Now the problem is that I got "Stream yields empty buffer" error whenever I used and manipulating method from gm, for that needed to check if my installed binaries there is correct, so added the following in my lambda handler function:

const exec = require('child_process').exec;
exec("gm -help", console.log)

And got the following "Permission denied" error as shown below:

enter image description here

Any clue? Thanks in advance!

basimhennawi avatar Dec 07 '18 13:12 basimhennawi

Got it solved! Too much details to list here. Gonna close it.

basimhennawi avatar Dec 18 '18 10:12 basimhennawi

@basimhennawi can you elaborate somewhere else? I too have this use case and issue :)

KempfCreative avatar Mar 26 '19 16:03 KempfCreative

@basimhennawi Facing the same issue, what was your final folder structure? and can you elaborate a bit on the issue?

puneeth8994 avatar Apr 04 '19 07:04 puneeth8994