Azure function - CosmosDB
I have below function, trying to learn
[FunctionName("BindingTrigger")] public async Task<IActionResult> BindingTrigger( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req, ILogger log, [Blob("sample-blob/test.txt", FileAccess.Read, Connection = "AzureWebJobsStorage")] Stream outputBlob, [CosmosDB("azurefunctions", "FileContents", Connection = "CosmosConnStr", CreateIfNotExists = true)] IAsyncCollector<FileContents> documents) { log.LogInformation("C# HTTP trigger function processed a request.");
try { await documents.AddAsync(new FileContents { PartitionKey = Guid.NewGuid().ToString(), RowKey = "1", Name = "test.txt", Contents = outputBlob.Length.ToString() }); } catch (Exception ex) { log.LogInformation(ex.Message); }
return new OkObjectResult($"Size of file: {outputBlob.Length}"); }
When i execute, it logs "C# HTTP trigger function processed a request.", but after that nothing. Function time's out after 30mins. No exception as well.
I was first trying with emulator running in docker, then tried with CosmosDB instance in Azure as well. But same result.
Thought may be issue with port restriction on my office laptop, so tried in my personal one, but same result. I'm really stuck, any suggestions?