0

How do I use docuementdb binding with azure function http binding:

using System.Net;

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, out object locationDocument, TraceWriter log){
    log.Info("C# HTTP trigger function processed a request.");
    var data = await req.Content.ReadAsStringAsync();

    return req.CreateResponse(HttpStatusCode.OK, $"{data}");
}

Getting this error:

error CS1988: Async methods cannot have ref or out parameters
Janusz Nowak
  • 2,595
  • 1
  • 17
  • 36
Alvin
  • 8,219
  • 25
  • 96
  • 177

1 Answers1

1

This is not specific to Document DB. If your function is async, and you already used the return value for HTTP output binding, you would need to inject IAsyncCollector<T> for all other output bindings.

See the second example in this answer.

Community
  • 1
  • 1
Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107