David Crook
David Crook

Reputation: 2730

Azure Functions | Could not find "func: host start" | Python

Problem

I'm in VS Code, I hit f5 to debug a project I've had around for a while and been actively working on (including last week) and I am now getting "Could not find the task 'func: host start'. I check out the output logs and I have the following error in there:

Error: The func task detection didn't contribute a task for the following configuration: { "type": "func", "command": "host start", "problemMatcher": "$func-python-watch", "isBackground": true, "dependsOn": "pip install (functions)" } The task will be ignored.

Needless to say, I can not debug my durable functions, which is a necessary task for I hope obvious reasons.

Things I've Checked so Far.

Things to be aware of

Thanks for any answers, whatever solves it gets marked as correct, other suggestions are always appreciated as well.

Upvotes: 1

Views: 8254

Answers (5)

Marshall
Marshall

Reputation: 25

I just wanted to share my fix for this, for myself it was actually the Azure Function Core Tools that was on the wrong version. My VS code was on version 4, but I was unable to install version 4 of the Azure Function Core Tools (it was failing on my windows machine for some unknown reason), so i opted to install version 3, and then my Azure Function started giving me this error. I was simply trying to follow Microsoft's example project. Eventually i found a different version of 4 to download that my computer managed to successfully install.

This is the version i installed in the end. https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Cisolated-process%2Cnode-v4%2Cpython-v2%2Chttp-trigger%2Ccontainer-apps&pivots=programming-language-python#install-the-azure-functions-core-tools

Then i restarted VS code and tried again and it worked!

Upvotes: 0

Anyderre
Anyderre

Reputation: 21

Add to the task.json of your python function app. Below .vscode/task.json and then hit F5 to debug and let it install the broken installation of azure function properly.

{
      "type": "func",
      "command": "extensions install",
      "problemMatcher": [],
      "label": "func: extensions install"
    }

hope this help!

Upvotes: 2

MDMower
MDMower

Reputation: 859

The easiest solution to this problem for me is to open the Azure extension from the sidebar. This seems to be the trigger needed to make Azure login and suddenly the func: host start launch config "just works". Here's a beautiful graphic to illustrate this further:

Azure extension in VSCode sidebar

Upvotes: 1

cory.street
cory.street

Reputation: 31

This happens to me every time I restart. Same setup.

To resolve I simply uninstall/reinstall the "Azure Functions" extension in VS Code.

Hope this helps!

Upvotes: 2

Delliganesh Sevanesan
Delliganesh Sevanesan

Reputation: 4776

I tried to reproduce the issue could not find the task func host start many times in my VS Code when running the Azure Functions Python and resolved it using below steps:

  • Create Azure Durable Functions Python (Orchestrator, Activity & Http Starter) and Virtual Environment in VS Code Editor.
  • Added the below code in the code files:

In requirements.txt:

azure-functions
azure-functions-durable

Open the Integrated terminal using Command palette (Ctrl + Shift + P) in VS Code > Select PowerShell Integrated Console/terminal or Switching to PowerShell using the terminal directly: enter image description here

Run this code to activate Virtual Environment: .venv\scripts\activate After activating the Virtual Environment, python -m pip install -r requirements.txt to install the packages.

  • Using command func host start, it came across to the error like enter image description here

After sometimes, this was the errors:

enter image description here

enter image description here

Azure Storage Emulator is running via Azurite in Visual Studio code but when I start the deprecated application Azure Storage Emulator, then I got a popup that was the Compute Azure Storage Emulator Shutdown is Started and then When I run the function With debugging, it starts working successfully:

enter image description here

enter image description here

enter image description here

Upvotes: 0

Related Questions