LoginSignup
0
0

More than 5 years have passed since last update.

[Azure] Visual Studio CodeでAzure Functionsのデバッグができないとき

Last updated at Posted at 2018-10-06

下記のURLにある手順に従っても、うまくいかないんです。
という時の対処方法です。

Deploy to Azure using Azure Functions
https://code.visualstudio.com/tutorials/functions-extension/getting-started

現象

Visual Studio Codeでデバッグ実行すると、下記メッセージが表示されます。

image.png

Cannot connect to runtime process, timeout after 10000ms (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:5858).

環境

  • macOS High Sierra
  • node 10.11.0
  • Visual Studio Code 1.27.2
  • Azure Functions拡張 0.11.0
  • Azure functions tools 2.0.3
  • .Net Core SDK 2.1.402

原因

node実行時に、--inspect=5858オプションが渡っていないから。

解決策

launch.jsonを開くと、preLaunchTaskとしてrunFunctionsHostが設定されています。

tasks.jsonを開きます。

tasks.json(抜粋)
{
  "version": "2.0.0",
  "tasks": [{
      "identifier": "runFunctionsHost",
      "type": "shell",
      "command": "func host start",
      "options": {
        "env": {
          "languageWorkers:node:arguments": "--inspect=5858",
        }
      },
  }]
}

--inspect=5858と書いてありますが、理解してもらえてないご様子です。

nodeの環境変数を直接指定することにします。

          "NODE_OPTIONS": "--inspect=5858"

このように書き換えます。

そのうち・・・・・・

Azure functions toolsが修正されて、この記事不要になるかな?

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0