vscode-azurefunctions icon indicating copy to clipboard operation
vscode-azurefunctions copied to clipboard

Debugger won't attach with JavaScript / NodeJS function & 3.0.394 tools

Open jkewley opened this issue 3 years ago • 7 comments

Standing up the most basic JavaScript-based Azure function using the VS code tooling produces a project which will execute and continue running in the background, but which won't attach and allow access to breakpoints. No messages are dumped to console about being unable to attach, even when running host start with --verbose. (Which, by the way, would be much easier to do if the team applied a label property to the host start task so that the name would match up with the generated preLaunchTask)

Steps to reproduce:

  • Using any of the tooling available, create a new JavaScript function on disk somewhere. Choose HttpTrigger and anonymous access. Defaults otherwise
  • Open the generated index.js. Place a breakpoint
  • F5 or click Attach to Node Function
  • Watch the process start up and notice that the debugger controls disappear after a short while. Functions will execute, but no access to breakpoints

function tools version 3.0.3904 (x64) NodeJS 14.18.1 Storage Emulator 5.10.0.0 (tried with Azurite as well)

jkewley avatar Feb 12 '22 02:02 jkewley

Thanks for reporting @jkewley! We'll look into this.

Could you provide me with your OS version and VS Code versions?

Just to clarify, the process starts and you're able to hit the triggers, right? Is there anything that you can think of in your dev environment that might prevent the debugger from attaching?

nturinski avatar Feb 17 '22 23:02 nturinski

Hi @nturinski I've personally tried this across a couple of laptops. Windows 11 22000.527 with Node 14.9.0 Windows 10 1909 with Node 14.8.1

Both laptops are running the following VS Code:

Version: 1.64.2 (user setup)
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:02:28.252Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0

Functions Extension v1.6.0

I have a team of devs who are working on similar systems, none of who can attach to the running function to hit breakpoints.

The F5 experience starts the function in the background and it handle interactions well, logging output to the console, but debugging breakpoints aren't hit. It looks like VS code is trying to attach to the debugging endpoint after the function app starts (debugger bar is visible), but after a few seconds the debugger bar goes away without complaining about being unable to attach

jkewley avatar Feb 18 '22 16:02 jkewley

Ok I figured it out. One I disabled the Azure Logic Apps (Standard) v1.0.12 extension the debugger started working. This is obviously a problem, as we're developing an orchestration between Logic Apps and Functions, but at least I'm unlocked.

jkewley avatar Feb 19 '22 21:02 jkewley

Thanks for reporting this. Seems like a really hard to diagnose bug.

I'm not super familiar with the Azure Logic Apps extension, but do you know if it tries to run its own func host start command? I can't really figure out why we wouldn't be able to attach to the process unless we're unable to start the process on our end and then can't connect to it (since the host starts still)

nturinski avatar Feb 24 '22 22:02 nturinski

I don't know the answer to that, but it seems like the Logic Apps host takes over. I only figured it out because I saw a dialog with a Logic Apps title on it at one point when I opened the project. I wonder if the LA extension took over because I added it after the functions extension. Something to test...

jkewley avatar Feb 24 '22 22:02 jkewley

The logic apps extension started out as a clone of this extension and that's why there are so many conflicting problems like this. Unfortunately we've never got them to fix it and our only recommendation is to uninstall/disable that extension. Their repo is private, so users can't even give feedback: https://github.com/microsoft/vscode-azurefunctions-clone

ejizba avatar Feb 25 '22 01:02 ejizba

Should be fixed by https://github.com/microsoft/vscode-azurefunctions-clone/commit/5793b89437f7b86afd0031851fcecfa9115e9c9b

nturinski avatar Jul 18 '22 23:07 nturinski

Verified that Logic Apps shipped the fix 🎉

nturinski avatar Sep 15 '22 22:09 nturinski