Trying to deploy 3 functions of different types(CosmosDBTrigger/TimerTrigger/HttpTrigger) in the same azure function app service account, attached the folder structure for reference.
Functions are not working as expected but throwing error after successful deployment.
Function (CopyToQueue) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'CopyToQueue'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'inputCloudSyncJobModels' to type IEnumerable`1. 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.).
public static async Task Run([**TimerTrigger**(scheduleExpression: "%TimerConfig%")]TimerInfo myTimer,
[CosmosDB(databaseName: "%DatabaseName%",
collectionName: "%InputCollection%",
SqlQuery ="%JobsSelectQuery%",
ConnectionStringSetting = "CosmosDBConnectionString")]
IEnumerable<object> **inputCloudSyncJobModels**,
[Queue(queueName: "%JobsQueueName%", Connection = "StorageConnectionString")] IAsyncCollector<string> outputCloudQueueModels,
Microsoft.Extensions.Logging.ILogger log, ExecutionContext context)
If I deploy same functions under different individual azure function app services they are working charm without any modifications.
Please suggest the way to make these functions as working ones when they are deployed under same azure function app service.
Organize your functions As part of your solution, you likely develop and publish multiple functions. These functions are often combined into a single function app, but they can also run in separate function apps.
It's possible for multiple function apps to share the same storage account without any issues. For example, in Visual Studio you can develop multiple apps using the Azure Storage Emulator.
Dedicated plan Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request. This is because of the default idle timeout of Azure Load Balancer.
Note that because any Azure Function can have exactly only one trigger as specified, the trigger type you intend to use is what differentiates your Azure Functions when you create them in Visual Studio, so let's take a look at that.
I disagree with Marc's answer. Although it might deviate from the documented standard but from architectural point of view it is very good to include multiple related functions under same App Service. This comes extremely handy while using Service Principal Secrets and Object IDs.
Solution:
Package all three functions in different directories i.e., CosmosDBTrigger, TimerTrigger, HttpTrigger as separate functions but use one SINGLE host.json for all three. Note that: You need to include all three function's host information in one file. Then after deployment you'll see multiple function under single app service. Also in portal after clicking on resource you'll be redirected to App Service dashboard then under Functions tab you can access each function separately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With