Introduction
This blog explains a peculiar issue faced when Azure Durable Functions are deployed using Azure DevOps.
In case you need to know what Azure Durable Functions are, please refer to Microsoft’s documentation on Durable Functions here as the explanation of it, is not under the scope of this blog.
Durable functions work best when built with versions .NET Core 2.2 and above. After developing and testing a durable function, it can be deployed to Azure in many ways. Deploying using Visual Studio also works fine.
Azure DevOps is Microsoft’s CI/CD offering and Microsoft’s documentation on deploying Azure Functions to the cloud can be viewed here.
You need to select the correct templates for build and release.
Problem Context
“Microsoft.Azure.WebJobs.Host: Error indexing method ‘MyFunction’. Microsoft.Azure.WebJobs.Host: Cannot bind parameter ‘starter’ to type DurableOrchestrationClient. Make sure the parameter Type is supported by the binding. If you’re using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you’ve called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.)”
Triaging
Durable Functions generate a file extensions.json to load all dependent types for execution. When deployed with Azure DevOps or any other CI/CD, the extensions.json fails to get deployed.
Proposed Resolution
Several Github threads have been raised for this issue. This thread is an example. After several trials and errors, the right packages required in the .csproj file of the Azure functions project are mentioned below.
Hack
If the above resolution doesn’t fix the issue, please try the below steps.
- Build the solution with Visual studio.
- Go to the \bin\Debug\netcoreapp2.2\bin You should be able to see the extensions.json file generated.
- Add the file to the Azure Function project in Visual studio.
- Add the snippet below to the .csproj file of the project.
- extensions.json should get deployed from there on. The file can then be deleted from the project after the issue is resolved.
Conclusion
Microsoft is aware of this issue and is expected to be resolved in the future.
Aslo, check out our blog Azure Durable Functions for a better understanding of key concepts and use cases.