Azure / Azure/azure-functions-dotnet-worker

Message body overrides metadata in ServiceBusTrigger function, dotnet-isolated

Open
#991 1 comment 0 reactions 0 assignees View on GitHub
needs-investigation
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

Properties from message body override metadata properties when using ServiceBusTrigger function in dotnet-isolated.
This does not happen in inproc mode.
This affects logging, correlations (e.g. when resending messages, or sending related messages), processing (when information from message envelope is needed).

Example:

Given the function:
```csharp
[Function("ServiceBusFunction")]
public static void Run(
[ServiceBusTrigger("mytopic", "mysubscription", Connection = "AzureServiceBus", IsSessionsEnabled = true)] string message,
string messageId,
string label,
string sessionId,
FunctionContext context)
{
var logger = context.GetLogger("ServiceBusFunction");
logger.LogInformation("C# ServiceBus topic trigger function processed message: {MessageId}\nLabel: {Label}\nSession: {SessionId}\n{Message}",
messageId,
label,
sessionId,
message);
}
```

When sending the message:
```
MessageId=[f7e7186e-196b-43f2-8fe2-407c9c829416]
SessionId=[session-1]
Label=[message-label]
Payload:
{
"name": "value",
"messageId": "override-message-id",
"label": "override-label",
"sessionId": "override-session-id"
}
```

The actual result is:
```
C# ServiceBus topic trigger function processed message: override-message-id
Label: override-label
Session: override-session-id
{
"name": "value",
"messageId": "override-message-id",
"label": "override-label",
"sessionId": "override-session-id"
}
```

The expected result is:
```
C# ServiceBus topic trigger function processed message: f7e7186e-196b-43f2-8fe2-407c9c829416
Label: message-label
Session: session-1
{
"name": "value",
"messageId": "override-message-id",
"label": "override-label",
"sessionId": "override-session-id"
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the ServiceBusTrigger binding behavior in the .NET isolated worker and compare it with in-process handling; the issue provides a complete reproducer but names no source files or tests. Done means message metadata such as MessageId, Label, and SessionId comes from the envelope even when the payload contains properties with the same names, while the payload remains unchanged.

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.