Closed ghost closed 5 years ago
Here's the complete set of logs for one request.
23:12:15 START RequestId: 435d25d8-c9bd-11e8-b440-87819a8ef2f0 Version: $LATEST 23:12:15 2018-10-06T23:12:15.109Z 435d25d8-c9bd-11e8-b440-87819a8ef2f0 INFO: key: [path] 23:12:15 2018-10-06T23:12:15.337Z 435d25d8-c9bd-11e8-b440-87819a8ef2f0 resize arg 23:12:15 2018-10-06T23:12:15.337Z 435d25d8-c9bd-11e8-b440-87819a8ef2f0 arg 600x600 23:12:15 2018-10-06T23:12:15.425Z 435d25d8-c9bd-11e8-b440-87819a8ef2f0 ERROR 500 null { Error: Command failed: convert: unable to open image `/tmp/resized.[bucket].[path].600.600': No such file or directory @ error/blob.c/OpenBlob/2643. at ChildProcess.
(/var/task/index.js:1:5024) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) a 23:12:15 2018-10-06T23:12:15.425Z 435d25d8-c9bd-11e8-b440-87819a8ef2f0 {"errorMessage":"[object Object]"} 23:12:15 END RequestId: 435d25d8-c9bd-11e8-b440-87819a8ef2f0
The problem happens when the image is in a subfolder.
A quick fix is to change in image.js the following line:
const resizedFile = `${os.tmpDir}/resized.${imageBucket}.${objectKey}.${width}.${height}`;
with:
const normalizeObjectKey = objectKey.split('/').join('.');
const resizedFile = `${os.tmpDir}/resized.${imageBucket}.${normalizeObjectKey}.${width}.${height}`;
It looks like #1 wasn't fixed with 0.1.1 after all.
I'm using the latest version (verified by redeploying and, separately, building and diffing against what the Lambda function code has).
There are similar errors when both width and height are supplied.