使用断点在Visual代码中本地调试较少的Server(节点js)。

时间:2018-09-19 21:07:57

标签: node.js debugging visual-studio-code serverless-framework serverless

我是无服务器框架的新手,正在尝试使用断点在Visual代码中本地调试无服务器(Node js)。

我提到了一些文章,但并没有帮助我很多。

https://medium.com/@OneMuppet_/debugging-lambada-functions-locally-in-vscode-with-actual-break-points-deee6235f590 https://hackernoon.com/running-and-debugging-aws-lambda-functions-locally-with-the-serverless-framework-and-vs-code-a254e2011010

1 个答案:

答案 0 :(得分:1)

最后,我能够解决此问题,缺少节点路径

“版本”:“ 0.2.0”,    “配置”:[

   {
       "type": "node",
       "request": "launch",
       "name": "Debug Local",
       "program": "${workspaceFolder}/node_modules/serverless/bin/serverless",
       "cwd": "${workspaceRoot}",
       "args": [
           "invoke",
           "local",
           "-f",
           "functionname",
           "--path",
           "../test.json",// pass the path of local test event
           "--stage",
           "AWs envrionment name" // eg: dev,stage, prod etc
       ],
       "env":{
           "NODE_PATH": "${cwd}"
       }
   }

] }