0

We are using Python 3.9 along with Azure function in Macbook M1. But we are not able to test the code locally

The type and problem matcher line comes with a yellow wiggly line and I cannot start my Test case { "version": "2.0.0", "tasks": [ { "type": "func", "command": "host start", "problemMatcher": "$func-python-watch", "isBackground": true, "dependsOn": "pip install (functions)" }, {

Ashis
  • 41
  • 1

1 Answers1

0

This issue might occur due to the Azure function extension and debugger not getting attached or initiated while you're running your Function in MacOS.

According to this SO thread answer by Pingpong and this Github link issue by Rashair Make sure you have the Azure function extension installed correctly in your VS Code and the launch.json is getting created correctly by the extension like below:-

Try re-installing the Azure Function extension like below:-

enter image description here

Upgrade the extension to Latest version by clicking on Uninstall > Install another version > select latest version like below:-

enter image description here

enter image description here

Or just uninstall the Azure function extension and install the Azure extension again. And restart your Visual studio

You can also configure debugger for your Function runtime language by clicking on Settings button beside uninstall > Extension Settings > And enable the debugger for your runtime like below:-

enter image description here

My launch.json:-

enter image description here

My task.json:-

{

"version": "2.0.0",

"tasks": [

{

"type": "func",

"label": "func: host start",

"command": "host start",

"problemMatcher": "$func-python-watch",

"isBackground": true,

"dependsOn": "pip install (functions)",

"options": {

"cwd": "${workspaceFolder}/api"

}

},

{

"label": "pip install (functions)",

"type": "shell",

"osx": {

"command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"

},

"windows": {

"command": "${config:azureFunctions.pythonVenv}\\Scripts\\python -m pip install -r requirements.txt"

},

"linux": {

"command": "${config:azureFunctions.pythonVenv}/bin/python -m pip install -r requirements.txt"

},

"problemMatcher": [],

"options": {

"cwd": "${workspaceFolder}/api"

}

}

]

}

Along with your azure function VS code extension make sure you have Azure function Core tools installed for your MacOS, You can download the Function core tool by from this link.

After installing the Azure function core tools, You can create your azure function app in VS code and run the command below:-

func host start

This will start your function app with debugger and run the trigger like below:-

enter image description here

Alternatively you can also directly click on Run at the top of your VS code and Start debugging to start your Function app.

Alternatively by following this document with function core tools installed you can create your function app locally with any supported framework by running this command in your terminal:-

func new --name HttpExample --template "HTTP trigger" --authlevel "anonymous"

enter image description here

And then run it locally with func start or func host start command.

Additionally,

According to this SO thread if you have any process dependency you can add it in your launch.json as per the answer by Martin Brandle

SiddheshDesai
  • 3,668
  • 1
  • 2
  • 11