Breakpoints not being hit when debugging Serverless in vscode

匿名 (未验证) 提交于 2019-12-03 01:05:01

问题:

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

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" } 

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.

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

回答1:

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"   } } 

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!