小编jad*_*n42的帖子

如何通过 VS Code 使用无服务器离线调试 AWS python lambdas?

我正在尝试找出一种使用无服务器框架和无服务器离线在 VS Code 中调试 AWS python lambdas 的方法。我已经到了可以在 VS Code 中运行 lambdas 的地步,但我无法设置断点。我不确定这是否可能,但从我读过的内容来看,它似乎是可能的。如果有人可以提供帮助,将不胜感激。

这是我当前的launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "node",
            "request": "launch",
            "cwd": "${workspaceRoot}",
            "runtimeExecutable": "npm",
            "runtimeArgs": [
                "run-script",
                "debug"
            ],
            "port": 9229,
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

package.json 的脚本部分如下:

"scripts": {
    "start": "./node_modules/.bin/serverless offline -s dev",
    "debug": "export SLS_DEBUG=* && node --inspect ./node_modules/.bin/serverless offline -s dev"
  }
Run Code Online (Sandbox Code Playgroud)

同样,此设置有效。我只是希望能够在我的 .py 文件中设置断点。当我将鼠标悬停在左侧装订线中的断点上时,它们会变灰并显示Breakpoint ignored because generated code not found (source map problem?).我不知道如何解决这个问题,因为 python 文件没有源映射。我尝试将outfilelaunch.json的字段设置为python 文件本身,但这显然不起作用。

在此先感谢那些能够提供帮助的人。 …

python debugging amazon-web-services serverless-framework serverless-offline

7
推荐指数
1
解决办法
518
查看次数