Azure / Azure/azure-functions-dotnet-worker

Returning ServiceBusMessage doesn't work correctly

Open
#1,819 12 comments 0 reactions 0 assignees View on GitHub
area: documentation design enhancement extensions: service-bus feature: sdk-bindings
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

When returning a `ServiceBusMessage`, the message posted contains incorrect information.

```
[Function(nameof(Run))]
[ServiceBusOutput("audit", Connection = "AzureServiceBus")]
public async Task Run([ServiceBusTrigger("Notifications", Connection = "AzureServiceBus")] ServiceBusReceivedMessage message)
{
// removed for brevity

return new ServiceBusMessage(rawMessage);
}
```

For an incoming message

![image](https://github.com/Azure/azure-functions-dotnet-worker/assets/1309622/ede05b3d-fe6c-4916-ac14-b0bb35d5d200)

The returned message body is

image

1 - missing original header
2 - incorrect body
3 - incorrect content type

## Expected:

![image](https://github.com/Azure/azure-functions-dotnet-worker/assets/1309622/17a64bbe-edad-406c-91be-007d3722e401)

1 - the original header (`EventType`) is found
2 - original body
3 - correct content type

Contributor guide

No contributing guide indexed for this repository

Research direction

The report provides a C# reproducer through Run using ServiceBusMessage, ServiceBusOutput, ServiceBusTrigger, and ServiceBusReceivedMessage. Start by running that flow and tracing how the output binding converts the returned message. Done means the posted message preserves the original EventType header, body, and content type shown in the expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.