Azure / Azure/azure-functions-host
Service Bus Output Binding is creating multiple messages from a JSON array when returning a string
- 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
Assessment
This issue has not been assessed yet.