The final output of my C# Precompiled Azure Function is to write to a blob storage as a JSON file. Am I writing to the Blob storage wrong? I hit the breakpoints set on the curly brackets at to the end of the function and it looks like it exits the function. Around 20 seconds later I get the exception:
Exception while executing function: ServiceBusTriggeredProcessAccepted. Microsoft.Azure.WebJobs.Host: Error while handling parameter outboundStringForBlobStorage after function returned:. Microsoft.WindowsAzure.Storage: The remote server returned an error: (500) Internal Server Error.
The Azure Function is a Service Bus triggered event. After processing fails the Service Bus queued item auto-increments and retries, a total of 10 times, before it's moved to the dead-letter queue. It should be noted the objects are large enough in size that regular Queue's are too small for them.
public class SomeObject
{
//15 Properties all string and boolean
public string Attachment{ get; set;}
public string AnotherProperty{ get; set;}
public bool IsConditionMet { get; set; }
//Maybe these aren't needed now since it's blob storage but it's part of the object currently
public string PartitionKey { get; set; }
public string RowKey { get; set; }
}
[FunctionName("ServiceBusTriggeredProcessAccepted")]
public static void Run([ServiceBusTrigger("accepted")]
SomeObject someObject,
TraceWriter log,
[Blob("accepted-attachments/{Attachment}", FileAccess.Read)] Byte[] blobContent
, [Blob("accepted-sent/{rand-guid}.json")] out string outboundStringForBlobStorage
)
{
someObject.PartitionKey = "email";
someObject.RowKey = Guid.NewGuid().ToString();
//Business Logic to execute here
SomeService.SomeFunctionToSendBlobFile(someObject, blobContent)
outboundStringForBlobStorage = JsonConvert.SerializeObject(someObject);
}
I am using:
Azure Functions SDK NuGet Package 1.0.21
Microsoft.Azure.Webjobs 2.2.0
WindowsAzure.ServiceBus 5.0.0
DotNetFramework 4.6.1
Windows Azure Storage Emulator 5.8.0.0
Runtime Version=1.0.11702.0
Does the serialization have to be sanitized somehow? I haven't had to sanitize in the past but the data in that object has changed and that is when the problems started to occur. I would expect that the file to get written to the blob storage immediately or return the exception immediately and not 20 seconds after exiting the function.