gpt4 book ai didi

azure - 无法在 VSCode 中调试 Azure Functions Core Tools

转载 作者:行者123 更新时间:2023-12-02 08:01:16 24 4
gpt4 key购买 nike

我目前在 VS Code 中调试 Azure Functions Core Tools 时遇到问题。我正在使用 npm 包 azure-functions-core-tools@2。正如我在许多资源中读到的那样,func host start/func start 应该始终使用 --inspect=9229 启动节点进程。如您所见,我的设置并非如此:

[4/30/19 4:51:25 AM] Starting language worker process:node  "/usr/lib/node_modules/azure-functions-core-tools/bin/workers/node/dist/src/nodejsWorker.js" --host 127.0.0.1 --port 50426 --workerId 3e909143-72a3-4779-99c7-376ab3aba92b --requestId 656a9413-e705-4db8-b09f-da44fb1f991d --grpcMaxMessageLength 134217728
[4/30/19 4:51:25 AM] node process with Id=92 started
[4/30/19 4:51:25 AM] Generating 1 job function(s)
[...]
[4/30/19 4:51:25 AM] Job host started
Hosting environment: Production

此外,所有更改托管环境的尝试都失败了。我尝试将 FUNCTIONS_CORETOOLS_ENVIRONMENT 添加到我的本地配置中,导致出现错误:

An item with the same key has already been added. Key: FUNCTIONS_CORETOOLS_ENVIRONMENT

我尝试使用 --debug 在启动和任务设置中添加多个环境变量,更改项目设置。没有任何效果。

我目前正在 Windows Linux 子系统 (WSL) 上运行它,除此之外它运行得非常好。

有人知道我在这里做错了什么吗?

最佳答案

我认为默认情况下没有启用调试。您必须将语言 worker 参数设置为 documented 才能工作。 .

  1. local.settings.json

    To debug locally, add "languageWorkers:node:arguments": "--inspect=5858" under Values in your local.settings.json file and attach a debugger to port 5858.

  2. func CLI
    您可以使用 --language-worker argument来设置它

func host start --language-worker -- --inspect=5858
  • 在 VS Code 中
    如果使用 VS Code 和 Azure Functions 扩展进行开发, --inspect.vscode/tasks.json中设置相应的环境变量时自动添加
  • {
    "version": "2.0.0",
    "tasks": [
    {
    "label": "runFunctionsHost",
    "type": "shell",
    "command": "func host start",
    "isBackground": true,
    "presentation": {
    "reveal": "always"
    },
    "problemMatcher": "$func-watch",
    "options": {
    "env": {
    "languageWorkers__node__arguments": "--inspect=5858"
    }
    },
    "dependsOn": "installExtensions"
    },
    {
    "label": "installExtensions",
    "command": "func extensions install",
    "type": "shell",
    "presentation": {
    "reveal": "always"
    }
    }
    ]
    }

    如果您愿意,您也可以直接设置此环境变量,而不是将其添加到 local.settings.json 中。也是。

    关于azure - 无法在 VSCode 中调试 Azure Functions Core Tools,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55914467/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com