How to debug aws lambda functions written in node js

后端 未结 9 3249
孤城傲影
孤城傲影 2021-02-20 13:34

We have been developing AWS Lambda functions in Node JS for a few months. Can we debug, i.e. step through the Node JS code as we can with .Net C# code in Visual Studio?

9条回答
  •  再見小時候
    2021-02-20 14:09

    The easiest option I have so far with VS Code is this:

    1. Create a new file, lets say call it debug.js and just call your lambda function from here, something like this: const app = require('./index') app.handler()

    2. Change program entry of the launcher.json file like this: "program": "${workspaceFolder}//debug.js"

    3. You can now just put a breakpoint on this line (app.handler()) and it works

提交回复
热议问题