Since the update to version 2.0.12050.0 of Azure Functions Apps, two of my functions are not indexed anymore. Unfortunately, the logging is not verbose enough to understand why the functions are not indexed.
Start my Function App
My function app starts properly with all functions are indexed or I have enough information (startup logs) to understand why some functions are not indexed.
My function app starts but two functions are not indexed and the logs are not providing enough information to understand why it鈥檚 not indexed:
2018-09-04T22:49:52.754 [Information] Starting Host (HostId=cpglane-ical, InstanceId=919b8d9d-834c-4717-9c4a-31465f335b87, Version=2.0.12050.0, ProcessId=8896, AppDomainId=1, Debug=True, FunctionsExtensionVersion=beta)
2018-09-04T22:49:52.757 [Information] Initializing Azure Function proxies
2018-09-04T22:49:50.267 [Information] Stopping JobHost
2018-09-04T22:49:53.797 [Information] Generating 4 job function(s)
2018-09-04T22:49:53.808 [Error] Error indexing method 'App.ManualUpdateCalendars'
2018-09-04T22:49:53.848 [Warning] Function 'App.ManualUpdateCalendars' failed indexing and will be disabled.
2018-09-04T22:49:53.848 [Error] Error indexing method 'App.ScheduledUpdateCalendars'
2018-09-04T22:49:53.865 [Warning] Function 'App.ScheduledUpdateCalendars' failed indexing and will be disabled.
None
After looking at the source code responsible for logging the error, it鈥檚 clear that the FunctionIndexingException's inner exception should also be logged for us to have a chance to understand the root cause of the indexing error.
OK, so upgrading to Microsoft.NET.Sdk.Functions 1.0.19 and Microsoft.Azure.WebJobs.Extensions.Storage 3.0.0-beta8 solved the indexing problem.
I'm not closing this issue though because logging of indexing errors definitely requires some improvements.
Browsing SO makes it pretty clear that this release was pretty rough.
I getting this same error, however, upgrading to beta8 and 1.0.19 didn't fix the issue for me:
[FunctionName("ScheduleFeed")]
public static async Task ScheduleFeed(
[TimerTrigger("0 5 * * * *", RunOnStartup = true)]TimerInfo myTimer,
ILogger log,
[Inject] IQueueManager<string[]> queueManager
)
Im having the same issue, it does work in two projects with ServiceBusTriggers but for my HttpTrigger project it failes.
I'm running a lot of functions using ~2 and my latest one has hit this. All the other functions have been fine. Everything I've tweaked hasn't worked. It would certainly be nice to have more information to work with to get through this issue.
Edit: My issue was that particular function was failing to start because a startup extension was throwing an exception. I agree with the OP, this would have been far easier to debug if the exception was logged.
I am getting the same issue
So it sounds like the main issue being reported here is a lack of errors being written for indexing errors. We fixed some bugs in this area in the last release of Azure Functions 2.0.12115. Are you still not getting detailed logs on this latest version?
Hi, I'm still getting the same. Still no exception details.
I'm running the functions on 2.0.12115.0
Hi, I'm still getting the same. Still no exception details.
I'm running the functions on 2.0.12115.0
we had it fixed by updating Microsoft.Azure.WebJobs.Extensions.DurableTasks from 1.6.1. to 1.6.2.
In fact, we were getting this issue only when adding CosmosDB I/O bindings to our functions.
I am not sure if the solution is because of the updates in that specific package or if that just caused some sort of refresh on the functions host.
however, that exception is hard to spot and for some reason it is not even popping up within the streaming logs. I agree with the previous comments: it needs to be captured and properly exposed to ease the debugging.
I have seen this when using a newer version of the Windows Azure Storage nuget package, it seems to be resolved by downgrading to the package version used in the functions sdk
Im able to reproduse the problem using the nuget package from this article https://blog.wille-zone.de/post/dependency-injection-for-azure-functions/. In a clean project, and a new clean Azure function on server. Works localy, breaks when pushed to Azure.
namespace FunctionApp3
{
public static class Function1
{
[FunctionName("Function1")]
public static IActionResult Run(
[HttpTrigger(AuthorizationLevel.Function, "get")]HttpRequest req,
[Inject]ITransientGreeter transientGreeter1,
[Inject]ITransientGreeter transientGreeter2,
[Inject]IScopedGreeter scopedGreeter1,
[Inject]IScopedGreeter scopedGreeter2,
[Inject]ISingletonGreeter singletonGreeter1,
[Inject]ISingletonGreeter singletonGreeter2,
ILogger logger)
{
logger.LogInformation("C# HTTP trigger function processed a request.");
var result = String.Join(Environment.NewLine, new[] {
$"Transient: {transientGreeter1.Greet()}",
$"Transient: {transientGreeter2.Greet()}",
$"Scoped: {scopedGreeter1.Greet()}",
$"Scoped: {scopedGreeter2.Greet()}",
$"Singleton: {singletonGreeter1.Greet()}",
$"Singleton: {singletonGreeter2.Greet()}"
});
return new OkObjectResult(result);
}
}
}
2018-10-03T13:47:46.443 [Error] Error indexing method 'Function1.Run'
2018-10-03T13:47:46.720 [Warning] Function 'Function1.Run' failed indexing and will be disabled.
I've been able to track this down to the [Inject] attribute. As soon as I remove it, the function fires right up.
I was able to fix the problem for my Azure functions by using the code in this article: https://blog.wille-zone.de/post/dependency-injection-for-azure-functions, however, I had to copy the code directly into project classes. For some reason, the nuget package wasn't working for me.
Once I did that, all of my inject attributes fired up. I have a tonne of build warnings about IFunctionFilter obsolescence now though.
Would it be possible to get your dependency list with versions @actias, still not working for me.
I鈥檓 using this test function https://github.com/glennwiz/azure-function-dependency-injection-test but still get the same errors on Server with Runtime version: 2.0.12115.0 (~2)
2018-10-04T11:57:58.852 [Information] Host initialization: ConsecutiveErrors=0, StartupCount=1
2018-10-04T11:57:58.890 [Information] Starting JobHost
2018-10-04T11:57:58.902 [Information] Starting Host (HostId=DummyTest-func, InstanceId=035e76d1-67fb-493f-b321-cac3133543f8, Version=2.0.12115.0, ProcessId=7352, AppDomainId=1, Debug=True, FunctionsExtensionVersion=~2)
2018-10-04T11:57:59.529 [Information] Generating 1 job function(s)
2018-10-04T11:57:59.550 [Error] Error indexing method 'GreeterFunction.Run'
2018-10-04T11:57:59.635 [Warning] Function 'GreeterFunction.Run' failed indexing and will be disabled.
2018-10-04T11:57:59.636 [Warning] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
2018-10-04T11:57:59.636 [Information] Host initialized (727ms)
2018-10-04T11:57:59.638 [Information] Host started (730ms)
2018-10-04T11:57:59.638 [Information] Job host started
2018-10-04T11:58:04.687 [Information] Host lock lease acquired by instance ID '2ee8dbca0c17fb4b4d8c562ef791535f'.
Error indexing method 'GreeterFunction.Run' Cannot bind parameter 'singletonGreeter1' to type ISingletonGreeter. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException:
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 174)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexTypeAsync>d__13.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 102)
Inner exception System.InvalidOperationException handled at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext:
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsyncCore>d__18.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 271)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult (System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+<IndexMethodAsync>d__17.MoveNext (Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35Microsoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Indexers\FunctionIndexer.csMicrosoft.Azure.WebJobs.Host, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35: 166)
We were using Boris Willhelms DI and solved the issue with following the solution in https://github.com/Azure/azure-functions-host/issues/3386#issuecomment-419565714
It has also been documented in the readme of Boris Willhelms DI repo.
The problem might be because of your Connection String.
Please Add the ConnectionString in LocalSetting to the key: AzureWebJobsStorage,
And from the Actual Azure function params Connection ref to the above Key.
This resolved my Issue.
In my case, I had pulled into Microsoft.Azure.WebJobs.Extensions.DocumentDB NuGet package into my .Net Core 2.1 project and was getting the same error. It was evident with the imported NuGet showing a warning message saying it was pulled using .Net FW 4.6.1. I was able to resolve this issue by uninstalling DocumentDB NuGet followed by installing Microsoft.Azure.WebJobs.Extensions.CosmosDB
Most helpful comment
We were using Boris Willhelms DI and solved the issue with following the solution in https://github.com/Azure/azure-functions-host/issues/3386#issuecomment-419565714
It has also been documented in the readme of Boris Willhelms DI repo.