Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.29k stars 426 forks source link

Cannot run a PowerShell app with Http trigger on M1 Mac #3699

Open lilyjma opened 2 months ago

lilyjma commented 2 months ago

Steps to reproduce:

  1. Create a function app in Visual Studio Code and pick the Http trigger template
  2. Run the app with func host start --verbose

You'll get the following error: HttpTrigger: [GET,POST] http://localhost:7071/api/HttpTrigger

[2024-06-07T21:27:23.734Z] Language Worker Process exited. Pid=88228. [2024-06-07T21:27:23.735Z] dotnet exited with code 137 (0x89). . [2024-06-07T21:27:23.862Z] Failed to start a new language worker for runtime: powershell. [2024-06-07T21:27:23.862Z] System.Private.CoreLib: A task was canceled. [2024-06-07T21:27:23.889Z] System Log: { Log-Level: Information; Log-Message: Azure Functions PowerShell Worker version [4.0.3219.0]. } [2024-06-07T21:27:24.220Z] Language Worker Process exited. Pid=88234. [2024-06-07T21:27:24.221Z] dotnet exited with code 137 (0x89). . [2024-06-07T21:27:34.767Z] System Log: { Log-Level: Information; Log-Message: Azure Functions PowerShell Worker version [4.0.3219.0]. } [2024-06-07T21:27:35.191Z] Language Worker Process exited. Pid=88254. [2024-06-07T21:27:35.191Z] dotnet exited with code 137 (0x89). . [2024-06-07T21:27:35.197Z] Exceeded language worker restart retry count for runtime:powershell. Shutting down and proactively recycling the Functions Host to recover [2024-06-07T21:27:35.220Z] Stopping host... [2024-06-07T21:27:35.235Z] Stopping JobHost [2024-06-07T21:27:35.247Z] Job host stopped [2024-06-07T21:27:35.289Z] Host shutdown completed.

It seems that no workers are started successfully. This is true for both PowerShell 7.2 and 7.4.

Core Tools version: 4.0.5801 Mac Info: Apple M1 Pro, macOS Sonoma version 14.5

lilyjma commented 2 months ago

cc @davidmrdavid and @Francisco-Gamino

Francisco-Gamino commented 2 months ago

Adding @AnatoliB @andystaples

AnatoliB commented 2 months ago

I've just tried on a MacBook Air M2, the same OS, the same Core Tools version - it worked without issues. I suspect something wrong with the .NET installation. @lilyjma, what does dotnet --list-sdks report?

AnatoliB commented 2 months ago

Also, @lilyjma, do you have a standalone PowerShell installed on this machine? You don't need it to run PowerShell Function apps locally, but, if PowerShell happens to be installed for any reason, you may run into issues depending on how you installed it.

lilyjma commented 2 months ago

@AnatoliB I have several dotnet versions installed, here's what dotnet --list-sdks return: 6.0.414 [/usr/local/share/dotnet/sdk] 7.0.401 [/usr/local/share/dotnet/sdk] 8.0.100 [/usr/local/share/dotnet/sdk]

I installed PowerShell with brew install powershell/tap/powershell, per instructions here I have version: 7.4.2