本文介绍了在vscode中调试Serverless时未遇到断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在VSCode中调试基于无服务器的应用程序时,没有一个断点处于活动状态.

None of my breakpoints are active when debugging my serverless based application in VSCode.

launch.json

launch.json

{
  "configurations": [
    {
      "console": "integratedTerminal",
      "cwd": "${workspaceRoot}",
      "name": "Debug",
     "port": 5858,
      "request": "launch",
      "runtimeArgs": [
        "run-script",
        "vscode:debug"
      ],
      "runtimeExecutable": "npm",
      "type": "node"
    }
  ],
  "version": "0.2.0"
}

我的package.json

My package.json

...
"scripts": {
  ...
  "vscode:debug": "export SLS_DEBUG=* && node --inspect=5858 --debug-brk --nolazy ./node_modules/.bin/serverless invoke local -s local -f customerAlexa -p ./test/requests/FindAgent-First-GoodZip.json"
},
....

当我从菜单中选择开始调试"时,所有红色断点变为灰色,程序仅在不停止断点的情况下执行.

When I choose Start Debugging from the menu, all the red breakpoints go grey and the program just executes without stopping on the breakpoints.

我正在Mac上运行Node 6.11.2,Serverless 1.23.0.谢谢大家.

I am running Node 6.11.2, Serverless 1.23.0 on a Mac. Thanks all.

推荐答案

这是我的launch.json,它允许我使用断点.

Here is my launch.json which allows me to use breakpoints.

{
  "type": "node",
  "request": "launch",
  "name": "Launch Program",
  "program": "${workspaceRoot}/node_modules/.bin/serverless",
  "args": [
    "offline",
    "start",
    "--skipCacheInvalidation"
  ],
  "env": {
    "NODE_ENV": "development"
  }
}

我正在使用serverless-offline在本地运行.我也正在使用webpack和babel. skipCacheInvalidation 为此.

I am using the serverless-offline to run locally. I also am using webpack and babel. The skipCacheInvalidation is for that.

我希望这会为您指明正确的方向.

I hope this points you in the right direction.

这篇关于在vscode中调试Serverless时未遇到断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 15:15