1
votes

I am doing a little POC with Azure functions. I have created a simple HttpTrigger function from VS template, and if I debbug in localhost all works perfectly, but If I deploy in Azure I get an error when I try to launch the function:

An error has occurred. For more information, please check the logs for error ID 24d8e48f-d925-45ad-82cf-f767decc5f6f

If I check in Insights the error is:

Error indexing method 'Saluda.Run' Cannot bind parameter 'log' to type TraceWriter. 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.).

Call Stack:

Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+d__19.MoveNext (Microsoft.Azure.WebJobs.Host, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+d__15.MoveNext (Microsoft.Azure.WebJobs.Host, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) Inner exception System.InvalidOperationException handled at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+d__19.MoveNext: at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+d__20.MoveNext (Microsoft.Azure.WebJobs.Host, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer+d__19.MoveNext (Microsoft.Azure.WebJobs.Host, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)

I am using Microsoft.NET.Sdk.Functions 1.0.14 (last one), AzureWebJobsDashboard and AzureWebJobsStorage are configured in functions application settings. If I create a function directly in portal, it works.

any idea?

Thanks so much.

Function code

Configuration

Insights error

2

2 Answers

0
votes

You have created a v2 function locally, but in Application settings we can see FUNCTIONS_EXTENSION_VERSION(i.e. Runtime version in Function app settings) is ~1, which is used for v1 functions.

When you deploy it, you may see this tip pop out

enter image description here

You may have chosen No so that got the exception.

v1 functions target at .Net framework and v2 target at .Net standard, they have respective Runtime ~1 and beta. Not compatible with each other, so one runtime only support one kind of functions. That's why you got the error.

Solutions:

  1. If those existing v1 functions are useful, you need to create a new function app. Deploy v2 function to new function app, and feel free to choose Yes to change runtime to beta as it's ~1 by default. You can also go to Function app settings to change runtime to beta before creating any functions.

  2. If functions depending on ~1 runtime are useless, go to Application settings, change FUNCTIONS_EXTENSION_VERSION to beta, then delete v1 functions as they are no more in use. In this way, you don't need to delete all functions to change runtime from Function app settings and deploy again.