'Azure Queue Trigger reaches MaxDequeueCount immediately
I have an azure queue trigger set up:
[FunctionName("TransformData")]
public async Task Transform(
[QueueTrigger("product-prices")] string message)
{
await TransformAndLoadData(message);
}
Whenever I add items to the queue via the QueueClient:
(RawQueueData splits items into message batches)
var rawQueueData = new RawQueueData<T>(data);
var sendMessageTasks = rawQueueData.Messages
.Select(m => _queueClient.SendMessageAsync(m));
await Task.WhenAll(sendMessageTasks);
Or move the messages from product-prices-poison back to product-prices queue (using Azure Storage Explorer), the trigger immediately fails with:
Message has reached MaxDequeueCount of 5. Moving message to queue product-prices-poison.
Passing items synchronously also yields the same problem.
The only time I can successfully get the trigger to fire and process items is when I create a message with Azure Storage Explorer manually.
Increasing MaxDequeueCount, or batch size does not make a difference. The message after doing the former then is:
Message has reached MaxDequeueCount of 100000. Moving message to queue product-prices-poison.
I can also manually dequeue items by using the QueueClient without any issues.
I have also tried changing the type of object I am receiving to QueueMessage, object and string. Most other solutions seem to focus on updating the package (the one I am using the latest - stable 12.8.0).
EDIT: host.json:
{
"version": "2.0",
"extensions": {
"blobs": {
"maxDegreeOfParallelism": "4"
},
"queues": {
"maxDequeueCount": 5
}
}
}
Solution 1:[1]
Thank you for being my rubber duck.
After writing I soon realized the only different thing between azure storage explorer's "New Message" was the encoding.
After switching the messages encoding to Base64 it started working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Lukas |
