microsoft / DurableFunctionsMonitor

A monitoring/debugging UI tool for Azure Durable Functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Backend fails to start

HugoSousa opened this issue · comments

I've already checked issue #76 but still couldn't make it work and I'm not sure it's the same problem.

I can successfully run the backend directly in c:\Users<user>.vscode\extensions\durablefunctionsmonitor.durablefunctionsmonitor-6.3.0\backend by using command func start, but it doesn't work when I try to do it via VS Code.

When running through the VS Code extension, this is the logging I get:

yarn global bin failed. Command failed: yarn global bin
'yarn' is not recognized as an internal or external command,
operable program or batch file.
Using Functions host: func
Attempting to start the backend from c:\Users\<user>\.vscode\extensions\durablefunctionsmonitor.durablefunctionsmonitor-6.3.0\backend on http://localhost:37072/a/p/i...

The command just gets stuck for 60 seconds until it times out with the message "No response within 60 seconds. Ensure you have the latest Azure Functions Core Tools installed globally."

I'm using Windows and I can successfully run func command anywhere (installed globally with npm). I have Azure Function Core Tools version 4.0.5455 installed.

I think it's weird that it's printing simply func in the logs (I think it should be printing the full path there, right?). I've also tried setting the full path in the extension settings but got the same result (the path was logged, but would still get stuck attempting to start the backend).

Any ideas what might be the issue here?

Hi @HugoSousa , can you clarify which option did you use to install Azure Functions Core Tools on this machine?

I think it's weird that it's printing simply func in the logs

Indeed, it means that DfMon VsCode Ext was unable to detect the full path to func.exe and fell back to this line. Looks like Core Tools on your machine are in some interesting state which we haven't seen before.

Can you try to run some function app locally (e.g. that same backend you were trying to run manually) and check the full path to func.exe in Task Manager?
Also can you post the full console output (omitting any secrets) when doing that?

I've also tried setting the full path

Pardon, the full path to what? To func.exe? If yes, what was it?

Hi @scale-tone,

I believe I have previously installed Azure Functions Core Tools using .msi, but when trying to address the issue, I have uninstalled those (using "Add or Remove Programs" option in Windows) and installed them again globally using npm.

To mention also that I'm using nvm, with npm version 16.19.0 currently selected.

When I run func start in c:\Users\<user>\.vscode\extensions\durablefunctionsmonitor.durablefunctionsmonitor-6.3.0\backend, the following is logged:

Azure Functions Core Tools
Core Tools Version:       4.0.5455 Commit hash: N/A  (64-bit)
Function Runtime Version: 4.27.5.21554

Looking at the task manager, func.exe seems to be running from C:\Users\<user>\AppData\Roaming\nvm\v16.19.0\node_modules\azure-functions-core-tools\bin

Last time, I actually tried setting the futll path to func.exe in the VS Code extension settings to C:\Program Files\nodejs\node_modules\azure-functions-core-tools\bin (although this is just a shortcut to the same folder managed by nvm).

I tried to set the full path to func.exe in the VS Code extension settings with both folders, with equivalent results:

  1. Using C:\Users\<user>\AppData\Roaming\nvm\v16.19.0\node_modules\azure-functions-core-tools\bin
    I get the following log:
    Using Functions host: C:\Program Files\nodejs\node_modules\azure-functions-core-tools\bin
    But it errors immediately with message:
    Azure Functions Core Tools not found. Ensure that you have the latest Azure Functions Core Tools installed globally.

  2. Using C:\Program Files\nodejs\node_modules\azure-functions-core-tools\bin
    I get the following log:
    Using Functions host: C:\Users\huso\AppData\Roaming\nvm\v16.19.0\node_modules\azure-functions-core-tools\bin
    But it errors immediately with message:
    Azure Functions Core Tools not found. Ensure that you have the latest Azure Functions Core Tools installed globally.

It seems the extension cannot find the func.exe, although I can see it in the folders and can execute func --version globally. I cannot find an explanation for that.

If you're saying that func.exe has the C:\Users\<user>\AppData\Roaming\nvm\v16.19.0\node_modules\azure-functions-core-tools\bin path in Task Manager, then you need to set the Custom Path to Azure Functions Host setting precisely to C:\Users\<user>\AppData\Roaming\nvm\v16.19.0\node_modules\azure-functions-core-tools\bin\func.exe.

Note that it needs to be the full path to func.exe, not just full folder name.

DfMon extension caches this value, so every time you change that setting, you'll need to restart all instances of VsCode. Please, do so.

Oh, thanks, that did the trick! Now I feel stupid, but to me it made sense I only needed to point to the folder, as it should always use an executable named func.exe.

In any case, it seems that the extension failed to get the path of the Azure Function Core Tools in my machine. I'm reading the source code and trying to understand why this could happen.
In my machine, command npm list -g --depth=0 prints:

C:\Program Files\nodejs -> .\
+-- azure-functions-core-tools@4.0.5455
<other packages>

Is it expected that the first line has that -> .\? Could this be the reason why the extension is not able to parse the path correctly, since it tries to split only by \n here?

Is it expected that the first line has that -> .?

This must be some deep nvm-related specifics.
Tried to repro it (by installing nvm on a fresh vm) and failed.

Would you be able to provide details on how your machine ended up in this state?

No, I have no idea why I have it like this then, I must have installed nvm more than 2 years ago in this machine and don't remember doing anything but the basic commands.

Should be fixed in v6.4. Pls, validate.

I can run the backend without setting the custom path to Azure Functions host now, so it seems the fix is working. Thanks!