Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.31k stars 433 forks source link

Null Message Body Reprocessing Messages from Service Bus Subscription #3718

Closed TylrRssll closed 2 months ago

TylrRssll commented 3 months ago

We are encountering an issue that Azure support has not been able to help with so hopefully we may obtain an answer here.

We have a simple azure function using the latest python library version that when reading specific messages from a service bus subscription the body of the message is returning as null. The messages in question have been re-sent to the service bus topic from the dead letter queue as the original invocation of the function failed after reading the message body but the failure reason is unrelated to the issue I am reporting.

When the message is re-sent from the DLQ of the subscription to the topic the azure function will fire, the first command executed is

message.get_body().decode("utf-8")

When executed the body returned is null, however when viewing the message in service bus explorer prior to the function reading the message the body contains valid JSON.

What we have established is that if the topic has large message support enabled (max message size 10MB rather than the default 1MB), if a message is resent from the DLQ to the subscription, the body when read in the azure function using the snippet above is null, if the topic does not have large message support enabled the message body is NOT null.

After significant investigation a colleague of mine has found that the message published directly to the topic using any means (programmatically or via the azure portal service bus explorer) has a message body type of AmqpMessageBodyType.DATA but when the same message is re-sent from the DLQ and subsequently read by the azure function the message body type is AmqpMessageBodyType.VALUE.

My suspicion is that the get_body() method does not work as expected when the message body type is AmqpMessageBodyType.VALUE and thus returns a NULL.

Lastly the azure support team that provides support for the service bus service will no longer provide support on the issue as they claim as the message body is visible in service bus explorer the issue must lie with the azure functions sdk.

kshyju commented 2 months ago

@TylrRssll Would you mind updating your issue with the relevant code of your function app/function so the issue can be reproed at our end?

microsoft-github-policy-service[bot] commented 2 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

If you are not the original author (TylrRssll) and believe this issue is not stale, please comment with /bot not-stale and I will not close it.