Get the following error when trying to process a json object within Azure Function.

System.Private.CoreLib: Exception while executing function: xxxxxxxx. Microsoft.Azure.WebJobs.Host: Exception binding parameter 'myQueueItem'. System.Private.CoreLib: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.


        public static async Task<IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
            ILogger log)
            // Get message from body of POST.
            string requestBody = await new StreamReader(req.Body).ReadToEndAsync();

            QueueClient queue = new QueueClient(Environment.GetEnvironmentVariable("MyConnnectionString"), "myqueue");


            return new OkObjectResult("SUCCESS");

        private static string Base64Encode(string plainText)
            var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
            return System.Convert.ToBase64String(plainTextBytes);
public static Azure.Response<Azure.Storage.Queues.Models.SendReceipt> SendMessage(this Azure.Storage.Queues.QueueClient queueClient, object value)
            var plainText = JsonConvert.SerializeObject(value);
            var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
            return queueClient.SendMessage(Convert.ToBase64String(plainTextBytes));


Last modified: April 5, 2021



Write a Reply or Comment