Fails on nodejs10.x runtime
shiftie opened this issue · 8 comments
When ran on nodejs10.x lambda runtime, this fails after Reducing to: .
with this message:
ERROR Uncaught Exception
{
"errorType": "Error",
"errorMessage": "write EPIPE",
"code": "EPIPE",
"stack": [
"Error: write EPIPE",
" at WriteWrap.afterWrite [as oncomplete] (net.js:788:14)"
],
"errno": "EPIPE",
"syscall": "write"
}
I don't use this exact function so I can't say for sure if this is related to your error, but if you recently changed from the nodejs8.10 Lambda runtime to the nodejs10.x runtime, be aware that the underlying Amazon Linux 2 execution environment for nodejs10.x no longer includes the ImageMagick binaries. See this thread on the AWS forums for more information. I ended up creating a layer with the ImageMagick binaries to use with my lambda function that uses gm.
@mattcwill Thank you but I'm not using "resizing" feature (so ImageMagick is not supposed to be called at all).
I'm using reducing, here is the config:
{
"bucket": "my-bucket",
"acl": "public-read",
"cacheControl": "public, max-age=86400",
"keepExtension": true,
"backup": {
"directory": "original",
"template": {
"pattern": "*path/:file",
"output": "original/*path/:file"
}
},
"reduce": {
"directory": ".",
"quality": 90
}
}
I'm trying to get this working on nodejs10.x
because of the EOL email I got from AWS. I added the imagemagick layer per @mattcwill 's comment. The lambda runs, but produces a 0-byte image. My logs:
START RequestId: 4c5ab8e7-a0a1-44e2-9442-32be6d747944 Version: $LATEST
2019-11-11T16:18:23.773Z 4c5ab8e7-a0a1-44e2-9442-32be6d747944 INFO Parsing S3 event...
2019-11-11T16:18:23.787Z 4c5ab8e7-a0a1-44e2-9442-32be6d747944 INFO Downloading: original/14904.jpg
2019-11-11T16:18:23.942Z 4c5ab8e7-a0a1-44e2-9442-32be6d747944 INFO Resizing to: resized/300
2019-11-11T16:18:24.024Z 4c5ab8e7-a0a1-44e2-9442-32be6d747944 INFO Reducing to: resized/300
2019-11-11T16:18:24.032Z 4c5ab8e7-a0a1-44e2-9442-32be6d747944 INFO Uploading to: resized/300/14904.jpg (0 bytes)
2019-11-11T16:18:24.216Z 4c5ab8e7-a0a1-44e2-9442-32be6d747944 INFO OK, 1 images were processed.
END RequestId: 4c5ab8e7-a0a1-44e2-9442-32be6d747944
REPORT RequestId: 4c5ab8e7-a0a1-44e2-9442-32be6d747944 Duration: 451.06 ms Billed Duration: 500 ms Memory Size: 1280 MB Max Memory Used: 54 MB
My config.json:
{
"resizes": [
{
"size": "300x300^",
"format": "jpg",
"crop": "300x300",
"gravity": "Center",
"background": "white",
"directory": "resized/300"
}
]
}
I am looking at EOL as well @ericlathrop - have you learned anything since your comment ?
I'm guessing that it's a gm
package related issue:
I'll look into it and try to repro/fix
I'm getting the same error:
{
"errorType": "Error",
"errorMessage": "write EPIPE",
"code": "EPIPE",
"errno": "EPIPE",
"syscall": "write",
"stack": [
"Error: write EPIPE",
" at WriteWrap.afterWrite [as oncomplete] (net.js:789:14)"
]
}
I am using the lambda ImageMagick layer and have the memory limit set to 128mb.