AZF 自定义处理程序断点不停止

AZF Custom Handler Breakpoint not Stop

AZ 函数的自定义处理程序教程有效,但不会在处理程序内的断点处停止。拥有 Azure Functions 核心工具 - 3.0.3904、VSC 1.63.1 (windows 10)、Node 14.16

项目结构

root
|
|--host.json
|--local.settings
|
|--AF <folder>
|   |-- function.json
|
|--CH <folder>
    |-- app.js
    |-- host.json

app.js 断点:

var express = require('express');
var app = express();    // <--Breakpoint stops when starting
app.get('/cf', (req, res)=>
{
    var t=new Date();     // <--Breakpoint won't stop when hit with browser
    return res.json({users: t + "----" });
});
app.listen(port,() => {
    console.log('CH running', 3333)
})

root host.json

{
  ...
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 3.0.0)"
  },
  "customHandler": {
    "description": {
      "defaultExecutablePath": "node",
      "defaultWorkerPath": "CH/app.js"
    },
    "enableForwardingHttpRequest": true
  },
  "extensions": {"http": {"routePrefix": ""}}
}

local.settings.json

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node"
  }
}

AF/function.json

{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node"
  }
}

CH/host.json

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  }
}

launch.json

{
        "name": "Launch Program",
        "preLaunchTask": "func: host start",
        "program": "${workspaceFolder}/CH/app.js",
        "request": "launch",
        "skipFiles": [
            "<node_internals>/**"
        ],
        "type": "node"
    }

在此之后,我们选择迁移现有应用而不是 CH Re-Factor