Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open image #3

Closed
ghost opened this issue Oct 6, 2018 · 2 comments
Closed

Unable to open image #3

ghost opened this issue Oct 6, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 6, 2018

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).

2018-10-06T23:08:25.075Z ba15b78f-c9bc-11e8-933e-0fea3cb0308d ERROR 500 null { Error: Command failed: convert: unable to open image `/tmp/resized.[bucket].[path].600.NaN': 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)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) timedOut: false, killed: false, code: 1, signal: null }

There are similar errors when both width and height are supplied.

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)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) timedOut: false, killed: false, code: 1, signal: null }

@ghost
Copy link
Author

ghost commented Oct 6, 2018

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

@eneam
Copy link

eneam commented Oct 22, 2018

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}`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant