ysugimoto/aws-lambda-image

write EPIPE error

biztrology-kd opened this issue · 5 comments

{
"errorType": "Error",
"errorMessage": "write EPIPE",
"trace": [
"Error: write EPIPE",
" at WriteWrap.afterWrite [as oncomplete] (net.js:789:14)"
]
}

my image is 12M have this error,

I would recommend doing a full install with the new 10.x runtime and dedicated layer.

Had a number of issues with this today, and a full reinstall got it working for me.

I installed from scratch and the latest and I'm getting this error for pngs and jpgs with this config, images are around 400KB. gifs work fine:

{
    "bucket": "mybucket",
    "backup": {
        "directory": "./original"
    },
    "keepExtension": true,
    "reduce": {
        "directory": "./reduced",
        "quality": 70,
        "acl": "public-read"
    },
    "optimizers": {
        "pngquant": ["--speed=1", "--quality=60-90"],
        "mozjpeg": ["-optimize", "-progressive", "-quality 70"],
        "gifsicle": ["-O3"]
    }
}

My issue here was the following line:
"mozjpeg": ["-optimize", "-progressive", "-quality 70"],
Specifically, "-quality 70". Likewise, "-quality=70" didn't work.
This worked:
"mozjpeg": ["-optimize", "-progressive"],

This seems a little odd to me seeing as I can test on my cli like so:

/usr/local/Cellar/mozjpeg/3.3.1_1/bin/cjpeg -optimize -progressive -quality 70  ./gorilla.jpg > gorilla-opt.jpg

But I guess quality is being set above in the reduce stanza, so perhaps that's why.

jshow commented

I'm seeing the same symptom. Using tagged v1.1(aws-lambda-image-with-dedicated-layer), replicable with any jpeg (4mb largest file). Occurs whenever a reduce config is provided. It feels like the binaries are not installed to reduce? When the reduce config is removed resizes work as expected

  "reduce": { 
    "directory": "downloads/",
    "suffix": "_sixty_percent",
    "quality":90
  },

I've experimented with different optimizer options (as recommended here) without a positive effect

  "optimizers": {
    "mozjpeg": ["-optimize", "-progressive"]
  },
  "jpegOptimizer": "jpegoptim",
  "optimizers": {
      "jpegoptim": ["--all-progressive"]
  },
jshow commented

I was able to solve short-term with the following config - changing the reduce into a resizes

"resizes": [
    {
      "directory": "downloads/",
      "suffix": "_sixty_percent",
      "size": "100%",
      "quality": 60
    },