title: AWS Lambda not working along with the gm module
body: <p>I am using <a href="http://docs.aws.amazon.com/lambda/latest/dg/welcome.html" rel="noreferrer">AWS Lambda</a> to resize my image in <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html" rel="noreferrer">s3 bucket</a> into different size variants using node js when an image is put into the <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html" rel="noreferrer">s3 bucket</a>.</p>
  
  <p>It was working till yesterday. Today when I use the same lambda function I get the following error:</p>
  
  <pre><code>{
  "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.&lt;anonymous&gt; (internal/child_process.js:319:11)",
      "emitOne (events.js:77:13)",
      "Socket.emit (events.js:169:7)",
      "Pipe._onclose (net.js:469:12)"
      ]
  }
  </code></pre>
  
  <p>I am unable to understand why this phenomenon occurred. All the given functions of my lambda function below are in <a href="https://github.com/caolan/async" rel="noreferrer">async waterfall</a> to first compute the aspect ratio and then convert the image into different size variants.</p>
  
  <pre><code>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
  
  }
  </code></pre>
  
  <p>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. </p>