0
votes

I have created Azure Function application it was working fine but when I updated azure function version from 1.0 to 2.0. I am facing Dependency injection error. Its working fine on local but when I published it on Azure its through error .

2018-11-03T07:22:12.238 [Error] Error indexing method 'InviteFunctions.AcceptInvite' Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException : Error indexing method 'InviteFunctions.AcceptInvite' ---> System.InvalidOperationException : Cannot bind parameter 'inviteService' to type IInviteService. 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.). at async Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.IndexMethodAsyncCore(MethodInfo method,IFunctionIndexCollector index,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs : 272 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.IndexMethodAsync(MethodInfo method,IFunctionIndexCollector index,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs : 167 End of inner exception at async Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.IndexMethodAsync(MethodInfo method,IFunctionIndexCollector index,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs : 175 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.IndexTypeAsync(Type type,IFunctionIndexCollector index,CancellationToken cancellationToken) at C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.cs : 103 2018-11-03T07:22:12.331 [Warning] Function 'InviteFunctions.AcceptInvite' failed indexing and will be disabled. 2018-11-03T07:22:12.331 [Error] Error indexing method 'InviteFunctions.Invites'

Please help me out

1
I had the same issue. Had to revert back. The method I was using was to extend the attribute class but it failed when I attempted to upgrade to 2.0. Someone else might have a better suggestion.Jason Shave
Can you please post the code of your function here for better analysis.Sebastian Achatz

1 Answers

1
votes

We made some significant changes into how dependencies are injected between v1 and v2. The effort was to enable greater flexibility, but also provide a way to expose dependency injection to users as well. However that work is still underway - with a goal of being available around the end of this year. While a few people have poked around our bindings and triggers in GitHub, it's a big of 'no mans land' right now and I'd recommend against it if you can avoid. Is a very high priority item though.