azure-functions-durable-extension: Cannot run Azure Durable Functions on Mac M2 PRO
Description
When trying to create and run a new Azure Durable Function (.NET 7 | Isolated), I am unable to run it successfully.
A host error has occurred during startup operation '8643db33-586e-4c53-92d0-476fbeb08331'.
[2023-04-12T20:49:22.183Z] Grpc.Core: Error loading native library. Not found in any of the possible locations: /Users/apavate/Documents/Visual Studio Projects/OpenAIApps/DocumentUnderstanding/bin/Debug/net7.0/.azurefunctions/libgrpc_csharp_ext.arm64.dylib,/Users/apavate/Documents/Visual Studio Projects/OpenAIApps/DocumentUnderstanding/bin/Debug/net7.0/.azurefunctions/runtimes/osx-arm64/native/libgrpc_csharp_ext.arm64.dylib,/Users/apavate/Documents/Visual Studio Projects/OpenAIApps/DocumentUnderstanding/bin/Debug/net7.0/.azurefunctions/../../runtimes/osx-arm64/native/libgrpc_csharp_ext.arm64.dylib.
Value cannot be null. (Parameter 'provider')
NOTE: JavaScript issues should be reported here: https://github.com/Azure/azure-functions-durable-js
Expected behavior
Should run without any issues.
Actual behavior
Does not run.
Relevant source code snippets
Boiler-plate code generated when a new project is created inside Visual Studio for Mac.
### Known workarounds
> Provide a description of any known workarounds you used.
### App Details
- **Durable Functions extension version (e.g. v1.8.3)**:
- **Azure Functions runtime version (1.0 or 2.0)**:
- **Programming language used**:
### Screenshots
> If applicable, add screenshots to help explain your problem.
### If deployed to Azure
> We have access to a lot of telemetry that can help with investigations. Please provide as much of the following information as you can to help us investigate!
- **Timeframe issue observed**:
- **Function App name**:
- **Function name(s)**:
- **Azure region**:
- **Orchestration instance ID(s)**:
- **Azure storage account name**:
> If you don't want to share your Function App or storage account name GitHub, please at least share the orchestration instance ID. Otherwise it's extremely difficult to look up information.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (5 by maintainers)
Commits related to this issue
- Workaround to get Durable Functions run on M2 Mac. https://github.com/Azure/azure-functions-durable-extension/issues/2446#issuecomment-1517203490 — committed to azattekce/azuresamples by daronyondem 4 years ago
I want to update the instructions to make it easy for other developers.
Add the Nuget package
Contrib.Grpc.Core.M1to the Azure Function Project by either using the Nuget Package Manager or by just adding the following line to the.csprojfile.<PackageReference Include="Contrib.Grpc.Core.M1" Version="2.41.0" />Add the following line to the
.csprojfile right before the last</Project>tag.<Target Name="CopyGrpcNativeAssetsToOutDir" AfterTargets="Build"> <ItemGroup> <NativeAssetToCopy Condition="$([MSBuild]::IsOSPlatform('OSX'))" Include="$(OutDir)runtimes/osx-arm64/native/*" /> </ItemGroup> <Copy SourceFiles="@(NativeAssetToCopy)" DestinationFolder="$(OutDir).azurefunctions/runtimes/osx-arm64/native" /> </Target>Run the project and it should work!
Solution Credits: @vdboots
For now as a workaround:
Add the package reference
<PackageReference Include="Contrib.Grpc.Core.M1" Version="2.41.0" />And add this to your csproj.
<Target Name="CopyGrpcNativeAssetsToOutDir" AfterTargets="Build"> <ItemGroup> <NativeAssetToCopy Condition="$([MSBuild]::IsOSPlatform('OSX'))" Include="$(OutDir)runtimes/osx-arm64/native/*" /> </ItemGroup> <Copy SourceFiles="@(NativeAssetToCopy)" DestinationFolder="$(OutDir).azurefunctions/runtimes/osx-arm64/native" /> </Target>This will copy the needed file to the folder required. Until there is a fix
I’m actually not on M1/M2, I’m on an Intel Mac on .NET 8 having this issue.
For me the following seems to be getting me by for now…
If I didn’t do the above when I run my app it looks for the Grpc.Core assets in locations where they are not being output to by default.