QueueTriggered Azure function failing to read queue messages

I have an Azure Storage Queue that gets messages from an IoT device. The messages are not Base64 encoded, compressed or anything else. They are plain old UTF-8. Here’s a sample message:

{"id":"649251ce-5b46-9e3b-ac63-15fe4ffb852c","topic":"/SUBSCRIPTIONS/2BA02699-F96D-4474-BC02-888E2CF968F8/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/DVV1234","subject":"devices/DT12345","eventType":"Microsoft.Devices.DeviceTelemetry","eventTime":"2024-12-12T14:20:13.311Z","data":{"properties":{"alarm":"","history":null,"current":null,"devicemsg":null,"mqtt-dup":null},"systemProperties":{"iothub-connection-device-id":"DV12345","iothub-connection-auth-method":"{"scope":"device","type":"sas","issuer":"iothub"}","iothub-connection-auth-generation-id":"637432295369411031","iothub-enqueuedtime":"2024-12-12T14:20:13.311Z","iothub-message-source":"Telemetry"},"body":"IHsiRFQiOnsiVCI6ICIyMDI0LTEyLTEyIDE0OjIwOjE1In0gLCAiVW5pdCI6eyJJRCI6IjEwMTIzNDUiLCJOYW1lIjoiRFQxMjM0NSJ9LCAiQVMiOltdfQ=="},"dataVersion":"","metadataVersion":"1"}

My Azure queue triggered function is not reading these messages. Instead, it is just logging this message to the console for every message that drops in the queue:
[2024-12-12T14:31:09.342Z] Message has reached MaxDequeueCount of 5. Moving message to queue 'mqtt-inbound-poison'.

I have stripped the code down to the most basic queue trigger function app:
Program.cs:

using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.Extensions.Hosting;

var builder = FunctionsApplication.CreateBuilder(args);

builder.ConfigureFunctionsWebApplication();

// Application Insights isn't enabled by default. See https://aka.ms/AAt8mw4.
// builder.Services
//     .AddApplicationInsightsTelemetryWorkerService()
//     .ConfigureFunctionsApplicationInsights();

builder.Build().Run();

Function1.cs:

using System;
using Azure.Storage.Queues.Models;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.Logging;

namespace inboundtest
{
    public class Function1
    {
        private readonly ILogger<Function1> _logger;

        public Function1(ILogger<Function1> logger)
        {
            _logger = logger;
        }

        [Function(nameof(Function1))]
        public void Run([QueueTrigger("mqtt-inbound", Connection = "MyStorage")] QueueMessage message)
            try
            {
                _logger.LogInformation($"C# Queue trigger function processed: {message.MessageText}");
            }
            catch
            {
                _logger.LogError("An error occurred processing the message.");
            }
        }
    }
}

But the message about the MaxDequeueCount is all I get. I am 100% certain my queue name, mqtt-inbound, is correct. I am also certain the connection string is correct as I selected the storage account in Visual Studio when creating the project. I just built this minimal test code this morning and I am using the latest and greatest NuGet packages. Since neither my try nor catch message is being logged to the console, I suspect something is occurring before my function has even run, but what? What are my next steps in troubleshooting this?

New contributor

Tim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

2

You need to encode the message to Base64 while sending for Queue storage function to execute.

Checkout the Usage of Azure Queue storage triggered function app which says below :-

Functions expect a base64 encoded string. Any adjustments to the encoding type (in order to prepare data as a base64 encoded string) need to be implemented in the calling service.

I am sending the same message as given below-

Your function will trigger as expected.

Azure Functions Core Tools
Core Tools Version:       4.0.6610 Commit hash: N/A +0d55b5d7efe83d85d2b5c6e0b0a9c1b213e96256 (64-bit)
Function Runtime Version: 4.1036.1.23224

[2024-12-13T13:11:29.284Z] Found C:Users****sourcerepos792759737927597379275973.csproj. Using for user secrets file configuration.
[2024-12-13T13:11:32.640Z] Azure Functions .NET Worker (PID: 16076) initialized in debug mode. Waiting for debugger to attach...
[2024-12-13T13:11:32.691Z] Worker process started and initialized.

Functions:

        Function1: queueTrigger

For detailed output, run func with --verbose flag.
[2024-12-13T13:11:37.779Z] Host lock lease acquired by instance ID '0000000000000000000000000D2022A4'.
[2024-12-13T13:16:10.643Z] Executing 'Functions.Function1' (Reason='New queue message detected on 'mqtt-inbound'.', Id=2433e395-bfc6-4179-8d92-18ced5c5d629)
[2024-12-13T13:16:10.645Z] Trigger Details: MessageId: 897e917a-02d6-42e5-b64f-2b27deca77aa, DequeueCount: 1, InsertedOn: 2024-12-13T13:16:07.000+00:00
[2024-12-13T13:16:10.770Z] C# Queue trigger function processed: {
        "id":"649251ce-5b46-9e3b-ac63-15fe4ffb852c",
        "topic":"/SUBSCRIPTIONS/2BA****68F8/RESOURCEGROUPS/MYRESOURCEGROUP/PROVIDERS/MICROSOFT.DEVICES/IOTHUBS/DVV1234",
        "subject":"devices/DT12345",
        "eventType":"Microsoft.Devices.DeviceTelemetry",
        "eventTime":"2024-12-12T14:20:13.311Z",
        "data":
        {
                "properties":
                {
                        "alarm":"",
                        "history":null,
                        "current":null,
                        "devicemsg":null,
                        "mqtt-dup":null
                },
                "systemProperties":
                {
                        "iothub-connection-device-id":"DV12345",
                        "iothub-connection-auth-method":"{"scope":"device","type":"sas","issuer":"iothub"}",
                        "iothub-connection-auth-generation-id":"637432295369411031",
                        "iothub-enqueuedtime":"2024-12-12T14:20:13.311Z",
                        "iothub-message-source":"Telemetry"
                },
                "body":"IHsiRFQiOnsiVCI6ICIyMDI0LTEyLTEyIDE0OjIwOjE1In0gLCAiVW5pdCI6eyJJRCI6IjEwMTIzNDUiLCJOYW1lIjoiRFQxMjM0NSJ9LCAiQVMiOltdfQ=="
        },
        "dataVersion":"",
        "metadataVersion":"1"
}
[2024-12-13T13:16:10.809Z] Executed 'Functions.Function1' (Succeeded, Id=2433e395-bfc6-4179-8d92-18ced5c5d629, Duration=206ms)

Recognized by Microsoft Azure Collective

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật