I have a simple C# HttpTrigger
Azure function that retrieves data from CosmosDB
:
namespace urda
{
public static class GetAccount
{
[FunctionName("GetAccount")]
public static IActionResult Run(
[HttpTrigger(
AuthorizationLevel.Anonymous,
"get",
Route = "account/{id}")] HttpRequest req,
[CosmosDB(
"UrdaDemo",
"Accounts",
ConnectionStringSetting = "CosmosDBConnection",
SqlQuery = "select * from Accounts a where a.id = {id}")]
IEnumerable<Account> accounts,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
foreach (Account account in accounts)
{
log.LogInformation(account.id);
}
return new OkObjectResult(accounts);
}
}
}
The function worked fine until a few days ago (last checked on Nov. 22) and now it does not. It gives me the following error?
Function (Urda/GetAccount) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'GetAccount'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'accounts' 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.).
I have not changed anything nor redeployed the function and am not sure why I am getting this error? What is meant by "make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage()
..."?
Microsoft.Azure.WebJobs.Extensions.CosmosDb
extension as well into the project so your app “knows” how to talk to Cosmos? – jeffhollan