AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / coding / Perguntas / 79582673
Accepted
Manu Chadha
Manu Chadha
Asked: 2025-04-20 01:46:10 +0800 CST2025-04-20 01:46:10 +0800 CST 2025-04-20 01:46:10 +0800 CST

Não é possível testar e executar um projeto de função do Azure localmente no VS Code usando um código de repositório git

  • 772

Este repositório tem o código de uma função do Azure.

Quero abrir o repositório no VS Code, testá-lo localmente e depois publicar o código no Azure.

Baixei o zip e abri a pasta descompactada no VS Code.

O VS Code detectou que a pasta contém código de função do Azure e otimizou e adaptou conforme necessário, solicitando a linguagem (Python no meu caso) e o interpretador.

Como testo o código? Quando comecei a depurar usando a tecla F5, recebi o erro:

 *  Executing task: .venv\Scripts\python -m pip install -r requirements.txt 

Collecting azure-functions
  Using cached azure_functions-1.23.0-py3-none-any.whl (137 kB)
Collecting azure-ai-projects
  Using cached azure_ai_projects-1.0.0b9-py3-none-any.whl (199 kB)
Collecting azure-identity
  Using cached azure_identity-1.21.0-py3-none-any.whl (189 kB)
Collecting werkzeug~=3.0.6
  Using cached werkzeug-3.0.6-py3-none-any.whl (227 kB)
Collecting MarkupSafe>=2.1.1
  Using cached MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl (17 kB)
Collecting isodate>=0.6.1
  Using cached isodate-0.7.2-py3-none-any.whl (22 kB)
Collecting azure-core>=1.30.0
  Using cached azure_core-1.33.0-py3-none-any.whl (207 kB)
Collecting typing-extensions>=4.12.2
  Using cached typing_extensions-4.13.2-py3-none-any.whl (45 kB)
Collecting six>=1.11.0
  Using cached six-1.17.0-py2.py3-none-any.whl (11 kB)
Collecting requests>=2.21.0
  Using cached requests-2.32.3-py3-none-any.whl (64 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.4.1-cp38-cp38-win_amd64.whl (102 kB)
Collecting urllib3<3,>=1.21.1
  Using cached urllib3-2.2.3-py3-none-any.whl (126 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.10-py3-none-any.whl (70 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2025.1.31-py3-none-any.whl (166 kB)
Collecting msal-extensions>=1.2.0
  Using cached msal_extensions-1.3.0-py3-none-any.whl (28 kB)
Collecting msal>=1.30.0
  Using cached msal-1.32.0-py3-none-any.whl (114 kB)
Collecting cryptography>=2.5
  Using cached cryptography-44.0.2-cp37-abi3-win_amd64.whl (3.2 MB)
Collecting cffi>=1.12
  Using cached cffi-1.17.1-cp38-cp38-win_amd64.whl (181 kB)
Collecting pycparser
  Using cached pycparser-2.22-py3-none-any.whl (117 kB)
Collecting PyJWT[crypto]<3,>=1.0.0
  Using cached PyJWT-2.9.0-py3-none-any.whl (22 kB)
Installing collected packages: pycparser, cffi, urllib3, PyJWT, idna, cryptography, charset-normalizer, certifi, requests, typing-extensions, six, msal, MarkupSafe, werkzeug, msal-extensions, isodate, azure-core, azure-identity, azure-functions, azure-ai-projects
Successfully installed MarkupSafe-2.1.5 PyJWT-2.9.0 azure-ai-projects-1.0.0b9 azure-core-1.33.0 azure-functions-1.23.0 azure-identity-1.21.0 certifi-2025.1.31 cffi-1.17.1 charset-normalizer-3.4.1 cryptography-44.0.2 idna-3.10 isodate-0.7.2 msal-1.32.0 msal-extensions-1.3.0 pycparser-2.22 requests-2.32.3 six-1.17.0 typing-extensions-4.13.2 urllib3-2.2.3 werkzeug-3.0.6
WARNING: You are using pip version 21.1.1; however, version 25.0.1 is available.
You should consider upgrading via the 'C:\Users\manuchadha\OneDrive - Microsoft\Manu_Personal\programs\2025learnresolution\azure-ai-foundry-agent-main (1)\azure-ai-foundry-agent-main\.venv\Scripts\python.exe -m pip install --upgrade pip' command.
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: .venv\Scripts\activate ; func host start 

Can't determine project language from files. Please use one of [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]
Can't determine project language from files. Please use one of [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]
Can't determine project language from files. Please use one of [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]

Azure Functions Core Tools
Core Tools Version:       4.0.1 Commit hash: N/A +421f0144b42047aa289ce691dc6db4fc8b6143e6 (32-bit)
Function Runtime Version: 4.834.3.22875

Can't determine project language from files. Please use one of [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]
Can't determine project language from files. Please use one of [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]
Can't determine project language from files. Please use one of [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]
[2025-04-19T17:43:47.687Z] File 'C:\Program Files (x86)\dotnet\dotnet.exe' is not found, 'dotnet' invocation will rely on the PATH environment variable.
[2025-04-19T17:43:48.552Z] File 'C:\Program Files (x86)\dotnet\dotnet.exe' is not found, 'dotnet' invocation will rely on the PATH environment variable.
[2025-04-19T17:43:49.293Z] The 'FUNCTIONS_WORKER_RUNTIME' setting is required. Please specify a valid value. See https://go.microsoft.com/fwlink/?linkid=2257963 for more information. The application will continue to run, but may throw an exception in a future release.
[2025-04-19T17:43:49.513Z] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
For detailed output, run func with --verbose flag.
[2025-04-19T17:43:54.272Z] Host lock lease acquired by instance ID '0000000000000000000000001CFB97BF'.

insira a descrição da imagem aqui

  • 1 1 respostas
  • 68 Views

1 respostas

  • Voted
  1. Best Answer
    2025-04-21T17:59:52+08:002025-04-21T17:59:52+08:00

    Não é possível determinar o idioma do projeto a partir dos arquivos. Use um dos seguintes: [--dotnet-isolated, --dotnet, --javascript, --typescript, --java, --python, --powershell, --custom]. A configuração 'FUNCTIONS_WORKER_RUNTIME' é necessária. Especifique um valor válido.

    Esses avisos no log de erros sugerem que você está perdendo local.settings.json.

    Adicione local.settings.jsono arquivo no diretório raiz do projeto de função com a configuração abaixo.

    {
      "IsEncrypted": false,
      "Values": {
        "FUNCTIONS_WORKER_RUNTIME": "python",
        "AzureWebJobsStorage": "UseDevelopmentStorage=true"
      }
    }
    

    Clonei o mesmo projeto do GitHub, adicionei local.settings.jsone abaixo launch.json.

    .vscode=>launch.json:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Attach to Python Functions",
                "type": "debugpy",
                "request": "attach",
                "connect": {
                    "host": "localhost",
                    "port": 9091
                },
                "preLaunchTask": "func: host start"
            }
        ]
    }
    

    .vscode=>tasks.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)"
            },
            {
                "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": []
            }
        ]
    }
    

    .vscode=>settings.json:

    {
        "azureFunctions.deploySubpath": ".",
        "azureFunctions.scmDoBuildDuringDeployment": true,
        "azureFunctions.pythonVenv": ".venv",
        "azureFunctions.projectLanguage": "Python",
        "azureFunctions.projectRuntime": "~4",
        "debug.internalConsoleOptions": "neverOpen",
        "azureFunctions.projectLanguageModel": 2
    }
    

    Capaz de depurar a função localmente:

     *  Executing task: env\Scripts\activate && func host start 
    
    Found Python version 3.11.9 (py).
    
    Azure Functions Core Tools
    Core Tools Version:       4.0.6821 Commit hash: N/A +c09a2033faa7ecf51b3773308283af0ca9a99f83 (64-bit)
    Function Runtime Version: 4.1036.1.23224
    
    [2025-04-21T09:46:27.078Z] 0.03s - Debugger warning: It seems that frozen modules are being used, which may
    [2025-04-21T09:46:27.085Z] 0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
    [2025-04-21T09:46:27.087Z] 0.00s - to python to disable frozen modules.
    [2025-04-21T09:46:27.088Z] 0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
    [2025-04-21T09:46:27.154Z] Worker process started and initialized.
    
    Functions:
    
            agent_httptrigger:  http://localhost:7071/api/agent_httptrigger
    
    For detailed output, run func with --verbose flag.
    [2025-04-21T09:46:32.250Z] Host lock lease acquired by instance ID '000000000000000000000000F72731CC'.
    [2025-04-21T09:47:15.070Z] Executing 'Functions.agent_httptrigger' (Reason='This function was programmatically called via the host APIs.', Id=1c7d4fa8-5ead-4090-b5bc-2d338f5582f2)
    [2025-04-21T09:47:15.140Z] Python HTTP trigger function processed a request.
    [2025-04-21T09:47:15.193Z] Executed 'Functions.agent_httptrigger' (Succeeded, Id=1c7d4fa8-5ead-4090-b5bc-2d338f5582f2, Duration=144ms)
    
    • 0

relate perguntas

  • Adicionar número de série para atividade de cópia ao blob

  • A fonte dinâmica do empacotador duplica artefatos

  • Selecione linhas por grupo com 1s consecutivos

  • Lista de chamada de API de gráfico subscritoSkus estados Privilégios insuficientes enquanto os privilégios são concedidos

  • Função para criar DFs separados com base no valor da coluna

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Reformatar números, inserindo separadores em posições fixas

    • 6 respostas
  • Marko Smith

    Por que os conceitos do C++20 causam erros de restrição cíclica, enquanto o SFINAE antigo não?

    • 2 respostas
  • Marko Smith

    Problema com extensão desinstalada automaticamente do VScode (tema Material)

    • 2 respostas
  • Marko Smith

    Vue 3: Erro na criação "Identificador esperado, mas encontrado 'import'" [duplicado]

    • 1 respostas
  • Marko Smith

    Qual é o propósito de `enum class` com um tipo subjacente especificado, mas sem enumeradores?

    • 1 respostas
  • Marko Smith

    Como faço para corrigir um erro MODULE_NOT_FOUND para um módulo que não importei manualmente?

    • 6 respostas
  • Marko Smith

    `(expression, lvalue) = rvalue` é uma atribuição válida em C ou C++? Por que alguns compiladores aceitam/rejeitam isso?

    • 3 respostas
  • Marko Smith

    Um programa vazio que não faz nada em C++ precisa de um heap de 204 KB, mas não em C

    • 1 respostas
  • Marko Smith

    PowerBI atualmente quebrado com BigQuery: problema de driver Simba com atualização do Windows

    • 2 respostas
  • Marko Smith

    AdMob: MobileAds.initialize() - "java.lang.Integer não pode ser convertido em java.lang.String" para alguns dispositivos

    • 1 respostas
  • Martin Hope
    Fantastic Mr Fox Somente o tipo copiável não é aceito na implementação std::vector do MSVC 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant Encontre o próximo dia da semana usando o cronógrafo 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor O inicializador de membro do construtor pode incluir a inicialização de outro membro? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský Por que os conceitos do C++20 causam erros de restrição cíclica, enquanto o SFINAE antigo não? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul O C++20 mudou para permitir a conversão de `type(&)[N]` de matriz de limites conhecidos para `type(&)[]` de matriz de limites desconhecidos? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann Como/por que {2,3,10} e {x,3,10} com x=2 são ordenados de forma diferente? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller O ponto e vírgula agora é opcional em condicionais bash com [[ .. ]] na versão 5.2? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench Por que um traço duplo (--) faz com que esta cláusula MariaDB seja avaliada como verdadeira? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng Por que `dict(id=1, **{'id': 2})` às vezes gera `KeyError: 'id'` em vez de um TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob: MobileAds.initialize() - "java.lang.Integer não pode ser convertido em java.lang.String" para alguns dispositivos 2024-03-20 03:12:31 +0800 CST

Hot tag

python javascript c++ c# java typescript sql reactjs html

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve