I am trying to debug an azure function app in VSCode using Python in a Windows10 environment. Whenever I launch the debugger it hangs for a long period of time and then opens a message box that says
ECONNREFUSED 127.0.0.1:9091
There are a bunch of posts about this but none seem helpful/can solve the problem. Here is what I’ve tried:
- uninstalling and re-installing different versions of
azure-function-core-tools using windows installer, npm and chocolatey - uninstalling and re-installing Azure Functions extension in VS Code
- changing the extension bundle
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[3.3.0, 4.0.0)"
}
- modifying local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "python"
}
}
- deleting C:Usersadmin.azure-functions-core-toolsFunctionsExtensionBundles
- creating a function app from command line using "func init" and lauching debugger by running "func host start" in active venv
I am using Python38 and really have no idea what else to try. Any suggestions are welcome.
Thanks!
2
Answers
found the solution at: https://github.com/Azure/azure-functions-core-tools/issues/3160#issuecomment-1266273749
I ran command func start in verbose mode
from there it was clear that the process timed out when trying to download a new extension bundle. Most likely due to slow internet. I manually installed the new extension bundle:
https://functionscdn.azureedge.net/public/ExtensionBundles/Microsoft.Azure.Functions.ExtensionBundle/3.15.0/Microsoft.Azure.Functions.ExtensionBundle.3.15.0_any-any.zip
(the full path should be in the --verbose output) and extracted to
C:Users[user name].azure-functions-core-toolsFunctionsExtensionBundlesMicrosoft.Azure.Functions.ExtensionBundle3.15.0
It now works. Thanks everyone for input.
This type of generic error may occur for a variety of reasons.
Need to check and modify:
First and foremost, check whether the versions of
Azure functions core tools
andPip
are upgraded to the current version:To upgrade pip:
To install and upgrade azure-functions:
Go to the below path,
view -> Command palette -> User Settings
Python functions, task runFunctionsHost windows command only work with powershell:
Set the integrated > default profile: Windows to PowerShell as PowerShell runtime host is functional with Python functions. It was previously set to "null".
As stated here , the default listening port in launch.json is set to 9091. Here, I updated it to
"port: 7071"
which is open for traffic on my function project, launched the files, and then executed the "Attach to Python Functions" debug task once again.Under
.VScode folder -> launch.json
file, this configuration changes works for me.launch.json:
Added multiple debug points, debugged and triggered successfully as shown below:
Also Check here for more approaches given by @Hari Krishna