401074 (1) [Avatar] Offline
this.resize(width, height) ?
.toBuffer(imageType, function(err, buffer) { ?
if (err) {
} else {
next(null, response.ContentType, metadata, buffer);

imageType is never declared.
mrankin (3) [Avatar] Offline
I don't know if this helps, but this is the message I'm seeing in my logs:

Syntax error in module 'index': SyntaxError at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17) at require (internal/module.js:12:17)
Danilo Poccia (11) [Avatar] Offline
You are absolutely right! I usually try to clean up code from everything that could distract from the feature I'd like to show, and in my last minute effort I removed the part where I declare the imageType, required to define the picture format to use (for example jpg or png).

I'll fix this for the next update, in the meantime you can declare this function before the "exports.handler = ..." line:

function getImageType(key, callback) {
var typeMatch = key.match(/\.([^.]*)$/);
if (!typeMatch) {
callback("Could not determine the image type for key: ${key}");
var imageType = typeMatch[1];
if (imageType != "jpg" && imageType != "png") {
callback('Unsupported image type: ${imageType}');
return imageType;

You should also add this variable declaration, using the above function, just before the "async.waterfall(..." line:

var imageType = getImageType(srcKey);

I just tested everything and it works for me. Let me know if it is ok for you, thanks!