Cannot debug Node.js Google Cloud Functions (local emulator) with VS Code on Windows 10

I'm attempting to setup the local emulator for Google Cloud Functions and enable the VS Code debugging features. This is a huge headache and potentially a bug in the functions emulator...

I've followed this guide to the letter: https://github.com/GoogleCloudPlatform/cloud-functions-emulator/wiki/Debugging-with-Visual-Studio-Code.

Local environment:

  • Microsoft Windows [Version 10.0.15063]
  • Visual Studio Code 1.13.1 (any 3rd party extensions turned off)
  • NVM using Node 6.9.1

Repeatable steps:

1. Install local emulator for Google Cloud Functions: npm install -g @google-cloud/functions-emulator

2. Create a basic function:

exports.dbug = (req, res) => {
    var debugTest = 'Breakpoint'
    console.log('Debug breakpoint.')
    res.send('Response success.').status(200)}

3. Start the emulator, deploy the function, test it: functions start, functions deploy dbug --trigger-http, functions call dbug

enter image description here

4. Setup VS Code debugger. launch.json:

"version": "0.2.0",
"configurations": [
    {
        "type": "node",
        "request": "attach",
        "name": "Debug Functions",
        "processId": "${command:PickProcess}",
        "port": 5858
    }
]

5. Start functions debugger: functions debug dbug

6. Start VS Code debugger: enter image description here

7. Add breakpoint: enter image description here

8. Call function: functions call dbug. At this point, terminal sticks, and I have no idea what's going on. It doesn't seem to timeout, so I eventually terminate it. The functions emulator seems to completely hang after this and I have to kill the node.js process manually from task manager. enter image description here


I've tried some other approaches:

  • Restart everything. Then start functions, attach VS Code debugger, call function (don't do functions debug. This pauses on a step in net.js for some reason. When I continue, it does not stop at my breakpoint in the function and the function responds normally. enter image description here
  • Following this tutorial exactly: https://www.youtube.com/watch?v=5CZ1f6wzn4Q
  • Installing and adding @google/cloud-debug doesn't seem to change anything locally.