I'm trying to make a function that will take some input and store it in a cosmos db. I've written this function:
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
[FunctionName("DocumentUpdates")]
public static void Run([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequest req,
[CosmosDB("Fagkveld", "ViktigeData", CreateIfNotExists = true, Id = "Id", ConnectionStringSetting = "CosmosDbConn")]out dynamic document,
TraceWriter log)
{
document = new {Id="Identifier1", Title = "Some Title"};
}
But when I run this I get the following error:
[24.04.2018 07:05:15] Executed 'DocumentUpdates' (Failed, Id=ce0deab0-5ba3-4bb0-9399-96661c52ecb8)
[24.04.2018 07:05:15] System.Private.CoreLib: Exception while executing function: DocumentUpdates. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'document'. Microsoft.Azure.DocumentDB.Core: Value cannot be null.
[24.04.2018 07:05:15] Parameter name: serviceEndpoint.
Can someone tell me what I'm doing wrong? I can't find any serviceEndpoint parameter?
DocumentDBoutput binding type, notCosmosDB. Did you try it? learn.microsoft.com/en-us/azure/azure-functions/…