0

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

1 Answer 1

1

Just use the node-inspector it is for me the better way to debug code of backend

here is the link and there are complete guides to start witht that

https://www.npmjs.com/package/node-inspector

By the way is you want to debug some specific file use the node-debug

node-debug my_file_to_debug.js

I hope it help you.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.