1

I am just creating a new CosmosDBTrigger in the Azure Portal and connecting it to my Cosmos DB. Did not change anything. Just following the default example.

When I run it, I get the exception with the text from this question title. Here is the full log:

Exception while executing function: Functions.Test
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.Test ---> System.InvalidOperationException : Exception binding parameter 'documents' ---> System.InvalidOperationException : Unable to convert trigger to CosmosDBTrigger.   
   at Microsoft.Azure.WebJobs.Extensions.DocumentDB.CosmosDBTriggerBinding.BindAsync(Object value,ValueBindingContext context) 
   at async Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.BindCoreAsync[TTriggerValue](ValueBindingContext context,Object value,IDictionary`2 parameters)    
   End of inner exception   
   at Microsoft.Azure.WebJobs.Host.Executors.DelayedException.Throw()   
   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,ParameterHelper parameterHelper,TraceWriter traceWriter,CancellationTokenSource functionCancellationTokenSource)  
   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)  
   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)    
   End of inner exception

This is very strange. I remember doing just the same a month ago. Seems like something has been recently broken. Googling the particular message gives three useless results from the last month.

What can I do? Can I switch to some former version of something when things worked?

Community
  • 1
  • 1
psfinaki
  • 1,814
  • 15
  • 29
  • It would be awesome if you could provide a [mcve]. – mjwills Feb 19 '18 at 09:28
  • 1
    @mjwills With pleasure, but what would you like me to add? I am just clicking over the portal. _run.csx_ is equal to the code in the docs [link](https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb#trigger---c-script-example) I specified. _function.json_ differs only by the collection and database names. – psfinaki Feb 19 '18 at 09:37

1 Answers1

2

@psfinaki You cannot RUN the cosmos trigger from the Azure Portal, you must CREATE or UPDATE a document in the monitored collection for the trigger to RUN.

The RUN option should not be present or should be disabled in the Azure portal for Cosmos DB Triggers as it is not the same as other types of trigger options which do support "RUN" option directly.

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
  • 2
    You could refer to this [article](https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/azure-functions/functions-create-cosmos-db-triggered-function.md) to create the items collections for trigger to run cosmos trigger function. – Joey Cai Feb 20 '18 at 01:46