leonfancy / image-lambda

An AWS Lambda function that AWS S3 can invoke to create thumbnails or reduce file size for png and jpg images.
79 stars 11 forks source link

Reduce doesn't seem to work #3

Open ceccode opened 7 years ago

ceccode commented 7 years ago

Hi, if in the config.json file I leave the reduce section I get this error:

{
  "errorMessage": "spawn /var/task/node_modules/mozjpeg/vendor/cjpeg ENOENT",
  "errorType": "Error",
  "stackTrace": [
    "exports._errnoException (util.js:870:11)",
    "Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)",
    "onErrorNT (internal/child_process.js:344:16)",
    "nextTickCallbackWith2Args (node.js:437:9)",
    "process._tickDomainCallback (node.js:392:17)"
  ]
}

Example:

working config file:

{
  "resizes": [
    {
      "width": 100,
      "sourceDir": "images/uploads",
      "targetBucket": "example",
      "targetDir": "images/100w",
      "ACL": "public-read"
    },
    {
      "height": 200,
      "sourceDir": "images/uploads",
      "targetBucket": "example",
      "targetDir": "images/200h",
      "ACL": "public-read"
    }
  ]
}

not working config file:

{
  "reduce": {
    "sourceDir": "images/uploads",
    "targetBucket": "example",
    "targetDir": "images/reduce",
    "ACL": "public-read"
  },
  "resizes": [
    {
      "width": 100,
      "sourceDir": "images/uploads",
      "targetBucket": "example",
      "targetDir": "images/100w",
      "ACL": "public-read"
    },
    {
      "height": 200,
      "sourceDir": "images/uploads",
      "targetBucket": "example",
      "targetDir": "images/200h",
      "ACL": "public-read"
    }
  ]
}

Any ideas? Thanks