azureazure-functions

Error `Can't determine project language from files.` when using Azure Functions in VSCode


In this tutorial, when I run the function in step Create a function app to enrich your search index, I get error

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

As per this link, it seems I need to add variable FUNCTIONS_WORKER_RUNTIME in local settings file but the the zip file didn't come with the settings file.

How do I resolve the error?

There is a settings.json file in .vscode folder, which specifies that the project language is python.

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

Solution

  • As I mentioned in comment, I was also getting the same error when i downloaded the zip file from the link.

    To resolve this error create a file local.settings.json an set its value to below given data. These value are the required values for running python function locally.

    local.settings.json:

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

    OUTPUT:

    Just executing the downloaded zip file. That is why in getting invalid body in response here.