Search code examples
node.jsvisual-studio-codevscode-debugger

VSC Run and Debug - Process exited with code 1 - But runs fine in terminal


I am trying to test this serverless application but the Run and Debug function in VSC does not want to run it. I've tried numerous amount of pathing to the node modules but this does not change the outcome.

My configuration:

        {
        "type": "node",
        "request": "launch",
        "name": "invoke local",
        "program": "/Users/MYNAME/.nvm/versions/node/v17.8.0/lib/node_modules/serverless/bin/serverless",
        "args": [
            "invoke",
            "local",
            "-f",
            "${fileBasenameNoExtension}",
            "-p",
            "testEvents/${fileBasenameNoExtension}.json"
        ],
        "cwd": "${fileDirname}/../",
        "skipFiles": [
            "<node_internals>/**/*.js",
            "node_modules/**"
        ],
        "env": { "AWS_PROFILE": "awsProfile" },
        "outFiles": [
            "${workspaceRoot}/**/*.js"
        ]
    },

runs:

/Users/MYNAME/.nvm/versions/node/v17.8.0/bin/node ./../../../../../.nvm/versions/node/v17.8.0/lib/node_modules/serverless/bin/serverless invoke local -f fileName -p testEvents/FileName.json

which results in Process exited with code 1

When the same line is run terminal it returns the desired result.


Solution

  • Problem solved by running "console": "externalTerminal" in the config, this terminal gave me a more detailed error & in my case it was solved by fixed a typo in my AWS profile.

    Still strange that it did run the line in the terminal as mentioned before, I've some could explain that, would be great.