MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.29k stars 21.47k forks source link

Changing the value of "FUNCTIONS_WORKER_RUNTIME_VERSION" to "~7" prompts Azure Functions Core Tools to attempt utilizing .NET Core 3.1. #122079

Open ghost opened 6 months ago

ghost commented 6 months ago

[Enter feedback here]

Error details from VSCode:

PS /home/lgabor/repos/AzureEngineer/functions> func start                                                                                                    

Azure Functions Core Tools
Core Tools Version:       4.0.5611 Commit hash: N/A +591b8aec842e333a87ea9e23ba390bb5effe0655 (64-bit)
Function Runtime Version: 4.31.1.22191

[2024-04-29T12:11:43.951Z] You must install or update .NET to run this application.
[2024-04-29T12:11:43.951Z] Language Worker Process exited. Pid=28206.
[2024-04-29T12:11:43.952Z] dotnet exited with code 150 (0x96). .
[2024-04-29T12:11:43.952Z] App: /usr/local/lib/node_modules/azure-functions-core-tools/bin/workers/powershell/7/Microsoft.Azure.Functions.PowerShellWorker.dll
[2024-04-29T12:11:43.952Z] Architecture: x64
[2024-04-29T12:11:43.952Z] Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64)
[2024-04-29T12:11:43.952Z] .NET location: /usr/lib/dotnet/
[2024-04-29T12:11:43.952Z] The following frameworks were found:
[2024-04-29T12:11:43.952Z]   6.0.28 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
[2024-04-29T12:11:43.952Z] Learn about framework resolution:
[2024-04-29T12:11:43.952Z] https://aka.ms/dotnet/app-launch-failed
[2024-04-29T12:11:43.952Z] To install missing framework, download:
[2024-04-29T12:11:43.952Z] https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.23.10-x64
[2024-04-29T12:11:43.965Z] You must install or update .NET to run this application.
[2024-04-29T12:11:43.965Z] App: /usr/local/lib/node_modules/azure-functions-core-tools/bin/workers/powershell/7/Microsoft.Azure.Functions.PowerShellWorker.dll
[2024-04-29T12:11:43.965Z] Architecture: x64
[2024-04-29T12:11:43.965Z] Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64)
[2024-04-29T12:11:43.965Z] Language Worker Process exited. Pid=28212.
[2024-04-29T12:11:43.965Z] .NET location: /usr/lib/dotnet/
[2024-04-29T12:11:43.965Z] dotnet exited with code 150 (0x96). https://aka.ms/dotnet/app-launch-failed.
[2024-04-29T12:11:43.966Z] The following frameworks were found:
[2024-04-29T12:11:43.966Z]   6.0.28 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
[2024-04-29T12:11:43.966Z] Learn about framework resolution:
[2024-04-29T12:11:43.966Z] https://aka.ms/dotnet/app-launch-failed
[2024-04-29T12:11:43.966Z] To install missing framework, download:
[2024-04-29T12:11:43.966Z] https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.23.10-x64
[2024-04-29T12:11:43.968Z] Failed to start a new language worker for runtime: powershell.
[2024-04-29T12:11:43.968Z] System.Private.CoreLib: A task was canceled.

Functions:

        DurableFunctionsHttpStart: [POST,GET] http://localhost:7071/api/orchestrators/{FunctionName}

        Hello: activityTrigger

        HelloOrchestrator: orchestrationTrigger

For detailed output, run func with --verbose flag.
[2024-04-29T12:11:49.000Z] Host lock lease acquired by instance ID '000000000000000000000000722D15E8'.
[2024-04-29T12:11:53.971Z] You must install or update .NET to run this application.
[2024-04-29T12:11:53.971Z] App: /usr/local/lib/node_modules/azure-functions-core-tools/bin/workers/powershell/7/Microsoft.Azure.Functions.PowerShellWorker.dll
[2024-04-29T12:11:53.972Z] Architecture: x64
[2024-04-29T12:11:53.972Z] Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64)
[2024-04-29T12:11:53.972Z] Language Worker Process exited. Pid=28256.
[2024-04-29T12:11:53.972Z] .NET location: /usr/lib/dotnet/
[2024-04-29T12:11:53.972Z] dotnet exited with code 150 (0x96). https://aka.ms/dotnet/app-launch-failed.
[2024-04-29T12:11:53.972Z] The following frameworks were found:
[2024-04-29T12:11:53.972Z]   6.0.28 at [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
[2024-04-29T12:11:53.972Z] Learn about framework resolution:
[2024-04-29T12:11:53.972Z] https://aka.ms/dotnet/app-launch-failed
[2024-04-29T12:11:53.972Z] To install missing framework, download:
[2024-04-29T12:11:53.972Z] https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.23.10-x64
[2024-04-29T12:11:53.972Z] Exceeded language worker restart retry count for runtime:powershell. Shutting down and proactively recycling the Functions Host to recover

Updating to this property to the newest version of pwsh resolved the issue.

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME_VERSION": "7.4",
    "FUNCTIONS_WORKER_RUNTIME": "powershell"
  }
}

I came across additional information about specific versions that I believe should be included in this article. The tilde (~) symbol followed by the number 7 will consistently direct to version "7.0.x", consequently attempting to load .NET Core 3.x, which is has reached end of life support.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-powershell?tabs=powershell#running-local-on-a-specific-version


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

PesalaPavan commented 6 months ago

@glakatos Thanks for your feedback! We will investigate and update as appropriate.