[Python] Running Azure Functions with VS Code instanlty fails with ECONNREFUSED

Discussão em 'Python' iniciado por Stack, Março 7, 2025.

  1. Stack

    Stack Membro Participativo

    Yesterday I could run and debug my Azure Function project with VS Code. Today, when I'm hitting F5 ("Start Debugging"), a pop-up instantly appears with


    connect ECONNREFUSED 127.0.0.1:9091
    ​

    I believe it's a network issue, since VS Code doesn't even open a terminal displaying "Executing task [...]".

    But within VS Code I can browse the extension marketplace, run "pip install" within the terminal.

    Here is my configuration:

    launch.json


    {
    "version": "0.2.0",
    "configurations": [
    {
    "name": "Python: Current file",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal"
    },
    {
    "name": "Azure 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": "pipInstall",
    "options": {
    "cwd": "${config:azureFunctions.projectSubpath}"
    }
    },
    {
    "label": "pipInstall",
    "type": "shell",
    "command": "${config:python.pythonPath} -m pip install -r requirements.txt",
    "problemMatcher": [],
    "options": {
    "cwd": "${config:azureFunctions.projectSubpath}"
    }
    }

    ]
    }

    settings.json


    {
    "azureFunctions.deploySubpath": "azure-functions\\my_project",
    "azureFunctions.projectSubpath": "azure-functions\\my_project",
    "azureFunctions.scmDoBuildDuringDeployment": true,
    "azureFunctions.pythonVenv": ".venv",
    "azureFunctions.projectLanguage": "Python",
    "azureFunctions.projectRuntime": "~3",

    "debug.internalConsoleOptions": "neverOpen",
    "python.pythonPath": "C:\\Users\\myself\\BigRepo\\azure-functions\\my_project\\.venv\\Scripts\\python.exe",
    "powershell.codeFormatting.addWhitespaceAroundPipe": true
    //"terminal.integrated.shell.windows": "&&"
    }

    Continue reading...

Compartilhe esta Página