Invoke local serverless not running with debugger

Hi guys,

I usually install serverless in relation to my project and then i set vs code to start the serverless file in the node_modules, which seems to work up to now with any command with exception of invoke and invoke local.

in visual studio code i usually set my launch.json to something like this:

        "type": "node",
        "request": "launch",
        "name": "launch cryptonator aggregator",
        "program": "${workspaceRoot}/node_modules/serverless/bin/serverless",
        "cwd": "${workspaceRoot}",
        "protocol": "inspector",
        "args": [

Which results in the following command:

node --inspect-brk=49604 node_modules/serverless/bin/serverless deploy -f foo-function

Which launches and then hangs in (both terminal and vs code): Serverless: Invoke invoke:local after calling extendedValidate() when debbuging calling
stdin().then(input => { = input;

Which causes it to hang.
my current serverless version is 1.23.0 node v8.7.0 and v6.1.0.

Any help would be appreciated, as debbuging is always nice to have. Shall i open a github issue with it?

Wrapping the previous code around a quick hack like this seems to fix it:

const debug = typeof v8debug === ‘object’ || /–debug|–inspect/.test(process.execArgv.join(’ '));
if (debug) {
this.serverless.cli.log(‘skipping stdin pipping’);
} else {
stdin().then(input => { = input;

would there be a nicer way to fix this?

1 Like


I think you’re working too hard to reach your goal. The inspector has been natively supported in Chrome Dev tools for some time now. I know VS Code might be one of the best editors with debugging capabilities, but if you have a look at this video from Paul Irish you’ll get an idea how easy it could be.

For CLI applications like yours, the only difference I do is to not specify the number after the breaking point, like this example.

Just sharing idea.