AZF Custom Handler Breakpoint not Stop

76 views Asked by At

A tutorial Custom Handler for AZ Function works but won't stop at breakpoint inside handler. Have Azure Functions Core Tools - 3.0.3904, VSC 1.63.1 (windows 10), Node 14.16

Project structure

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

app.js with Breakpoints:

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"
    }
1

There are 1 answers

0
Jeb50 On BEST ANSWER

Instead of CH, we've opted to migrate existing app following this Re-Factor