I am testing the VS Code's built-in HttpTrigger
in Win 10, which is working, but the debugging is not working (breakpoints are not paused).
Below is the logging when starting Run -> Start Debugging
.
connect econnrefused 127.0.0.1:9091
It processes the request successfully, but no breakpoints are paused.
Executing task: .venv\Scripts\python -m pip install -r requirements.txt <
Requirement already satisfied: azure-functions in c:.me\mylab.code\azurecode\functions\funcpython\app.venv\lib\site-packages (from -r requirements.txt (line 5)) (1.11.2)
Terminal will be reused by tasks, press any key to close it.
Executing task: func host start <
Found Python version 3.9.13 (py).
Azure Functions Core Tools Core Tools Version: 3.0.3904 Commit hash: c345f7140a8f968c5dbc621f8a8374d8e3234206 (64-bit) Function Runtime Version: 3.3.1.0
Functions:
HttpTrigger1: [GET,POST] http://localhost:7071/api/HttpTrigger1
For detailed output, run func with --verbose flag. info: Microsoft.AspNetCore.Hosting.Diagnostics1 Request starting HTTP/2 POST http://127.0.0.1:63019/AzureFunctionsRpcMessages.FunctionRpc/EventStream application/grpc info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0] Executing endpoint 'gRPC - /AzureFunctionsRpcMessages.FunctionRpc/EventStream' [2022-07-21T21:23:59.336Z] Worker process started and initialized. [2022-07-21T21:24:03.839Z] Host lock lease acquired by instance ID '000000000000000000000000A150D788'. [2022-07-21T21:39:28.145Z] Executing 'Functions.HttpTrigger1' (Reason='This function was programmatically called via the host APIs.', Id=d2265561-ccdd-47e6-ae21-edc358753208) [2022-07-21T21:39:28.218Z] Python HTTP trigger function processed a request. [2022-07-21T21:39:28.338Z] Executed 'Functions.HttpTrigger1' (Succeeded, Id=d2265561-ccdd-47e6-ae21-edc358753208, Duration=208ms)
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Python Functions",
"type": "python",
"request": "attach",
"port": 9091,
"preLaunchTask": "func: host start"
}
]
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "func",
"command": "host start",
"problemMatcher": "$func-python-watch",
"isBackground": true,
"dependsOn": "pip install (functions)"
},
{
"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": []
}
]
}
What I tried:
1 I tried this from the link below, the connect econnrefused 9091
window doesn't display. But debugging is still not working.
https://stackoverflow.com/a/53722540/665335
2 I tried all three approaches from this, none of it is working. https://stackoverflow.com/a/71852516/665335
Environment:
Azure Func core tool: 3.0.4626
Function Runtime Version: 3.9.0.0
https://go.microsoft.com/fwlink/?linkid=2135274 https://github.com/Azure/azure-functions-core-tools
VS Code: Version 1.69
Python: 3.9.13
Python extension: v2022.10.1
Azure Functions extension: v1.7.4
After I updated relevant extensions, it works now.
Examples of the extensions (not all) might be relevant:
Azure Function: 1.7.4
Jupyter: 2022.6.12
Pylance: 2022.7.40
Python: 2022.10.1
There might be more extensions for you to update. Try to resolve all relevant extension updates if possible.