NodeBB crashed after uploading profile picture with PNG conversion
info: Attempting upload to: /home/c/public/uploads/1-profileimg.gif info: Attempting upload to: /home/c/public/uploads/1-profileimg.png error: Error: Command failed: at ChildProcess.<anonymous> (/home/c/node_modules/node-imagemagick/lib/imagemagick.js:87:15) at ChildProcess.EventEmitter.emit (events.js:98:17) at Process.ChildProcess._handle.onexit (child_process.js:789:12) http.js:691 throw new Error('Can\'t set headers after they are sent.'); ^ Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (http.js:691:11) at ServerResponse.res.setHeader (/home/c/node_modules/express/node_modules/connect/lib/patch.js:59:22) at ServerResponse.res.set.res.header (/home/c/node_modules/express/lib/response.js:518:10) at ServerResponse.res.send (/home/c/node_modules/express/lib/response.js:124:10) at ServerResponse.res.json (/home/c/node_modules/express/lib/response.js:191:15) at ServerResponse.res.send (/home/c/node_modules/express/lib/response.js:117:21) at null.callback (/home/c/src/routes/user.js:183:14) at Accumulator.finish (/home/c/node_modules/node-imagemagick/lib/imagemagick.js:60:55) at ChildProcess.<anonymous> (/home/c/node_modules/node-imagemagick/lib/imagemagick.js:92:11) at ChildProcess.EventEmitter.emit (events.js:98:17)
Not sure what this means here.
It means that a callback was called, and then a callback was called again... hmm...
Definitely looks like a bug to me.
And the picture doesn't crop or anything, it just simply uploads and converts the image extension.
EDIT: Only happens when uploading GIF images. If that helps.
This fixes the
throw new Error('Can\'t set headers after they are sent.');
It still doesn't explain why the im.convert is failing though. I tested with a few small gifs on my test environment with
convertToPngturned on and it works fine. So I couldn't reproduce that error. Can you provide a link to the gif you are using @trevor?
Its any GIF, so it might be Imagemagick but... I'm not quite sure.
Let me update the application to the latest commit to see what it does now.