I have an issue with the VSCode Node.js debugger.
I have the following code (it downloads an image an calculates its hash):
var request = require('request');
var crypto = require('crypto');
request({ uri : 'http://static.wixstatic.com/media/28f6fa_1519eb247c97446098566248a9f86441.jpg',
encoding: null,
timeout: 10000
}, function (err, res, body) {
if (err) {
return res.status(500).send(err);
}
if (res.statusCode !== 200) {
return res.status(500).send(buildResponse(500, "Image download returned status code " + res.statusCode));
}
console.log(crypto.createHmac('sha256', body).digest('hex'));
});
If I run node test.js, it prints the hash of the file perfectly.
If I run it using VSCode debug mode, it does not.
If I set a break point at line 4 (request({...), the debugger hits the break point.
If I set a break point at line 8 (if (err) { ...), the debugger does not hit the break point.
Am I doing something wrong or is this a bug?
$ node -v
v4.6.0
VSCode version: 1.6.1 Recovery Build