-
Notifications
You must be signed in to change notification settings - Fork 0
Choosing a Worker Runtime
The screenshot depicts the local development environment for Azure Functions, specifically the step where you're prompted to "Choose option:" for the worker runtime.
Key Observation:
- The prompt lists various worker runtime options:
- dotnet (isolated worker model)
- dotnet (in-process model)
- node
- python
- powershell
- custom
Why is this happening?
This prompt typically appears during the initial setup or when the Azure Functions Core Tools are unable to determine the project's runtime based on the configuration.
The most common reason for this is the absence or misconfiguration of the local.settings.json file in your Azure Functions project directory.
Explanation:
The local.settings.json file plays a crucial role in local development. It stores:
- Application settings: Environment variables, connection strings, etc., that your function app needs to run locally.
-
Runtime information: The
FUNCTIONS_WORKER_RUNTIMEsetting, which specifies the language and runtime to be used.
If local.settings.json is missing or the FUNCTIONS_WORKER_RUNTIME setting is not defined, the Azure Functions Core Tools cannot automatically detect the runtime, hence prompting you to select one manually.
Solution:
-
Create
local.settings.json: If the file doesn't exist, create it in the root of your Azure Functions project directory. -
Add
FUNCTIONS_WORKER_RUNTIME: Within theValuessection of yourlocal.settings.jsonfile, add theFUNCTIONS_WORKER_RUNTIMEsetting with the appropriate value (e.g., "dotnet-isolated", "dotnet", "node", "python", "powershell").
Example local.settings.json (for Python):
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsStorage": "UseDevelopmentStorage=true"
}
}