根据 AWS 文档,我将像这样启动本地 SAM:
$ sam local start-api -d 5858
Run Code Online (Sandbox Code Playgroud)
我的 launch.json 中有以下内容
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to SAM Local",
"type": "node",
"request": "attach",
"address": "localhost",
"port": 5858,
"localRoot": "${workspaceRoot}",
"remoteRoot": "/var/task"
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是当我启动 Visual Studio 调试器时,它说“无法连接到运行时,请确保运行时处于‘旧版’调试模式”
看起来很多人都在使用 Node.js 6 和 Visual Studio Code 时遇到这个问题,但我似乎找不到答案......我正在使用 Visual Studio Code 版本 1.18.1
我尝试将 "protocol": "Legacy" 添加到 launch.json 配置。我还尝试使用 --debug-port 而不是 -d 。我使用的是 Windows 10。不确定问题是否特定于 Windows。