Azure / Azure/azure-functions-host

Service Bus Output Binding is creating multiple messages from a JSON array when returning a string

Open
#11,319 9 comments 0 reactions 1 assignee Claimed by @satvu View on GitHub
bug design
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

Service bus output binding creating multiple messages when returning a string which is a JSON array. This has been noted since updating to **.Net 8** and using the **dotnet-isolated** function runtime. This behaviour has changed either between .Net upgrades or moving to isolated functions.

#### Repro steps

Run the following function:
```csharp
[Function("Test Func")]
[ServiceBusOutput("queuName", Connection = "ServiceBusConnectionString")]
public static async Task RunAsync(
[HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = null)] HttpRequestData req)
{
return await req.ReadAsStringAsync();
}
```

Call with this JSON payload:
```json
[
{
"Test1": "test1"
},
{
"Test2": "test2"
}
]
```

#### Expected behavior

A message is created with the body:
```json
[
{
"Test1": "test1"
},
{
"Test2": "test2"
}
]
```

#### Actual behavior

Two messages are created:

1)
```
{
"Test1": "test1"
}
```
2)
```json
{
"Test2": "test2"
}
```

#### Related information

Provide any related information

* Programming language used: C#
* Bindings used: HttpTrigger - ServiceBusOutputBinding

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.