1

I'm trying to write an Azure function that will output a blob, as well as return an HTTP response to the caller. The function.json part is pretty simple -

{ 
      "name": "$return", 
      "type": "http", 
      "direction": "out" 
    }, 
    {
      "type": "blob",
      "name": "outputBlob",
      "path": "outcontainer/{rand-guid}",
      "connection": "STORAGE",
      "direction": "out"
    }

But I'm running into issues accessing the blob output in my actual function code. Based on examples, it should look like this:

    public static async Task<HttpResponseMessage> Run(HttpRequestMessage req,
      out string outputBlob, TraceWriter log)
    {
    //proccess request and create blob output
    }

As you might expect, this throws an error, because you can't have an out parameter in an async call. I don't want to make the call synchronous, as we expect fairly high volume.

Is it even possible to have an HTTP output with a blob output? If so, how would you do it?

Cat
  • 11
  • 3

1 Answers1

0

I think my mistake was assuming the output blob could only be bound to a string, because that's what I saw in most of the examples. Changing the binding to a Stream, and then doing Stream.WriteAsync before I returned the HTTP response solved the issue.

Cat
  • 11
  • 3