Azure / Azure/Azure-Functions

Azure function request body is always NullStream

Open
#2,614 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

I have a Azure V4 isoloated C# function that has been working ok for a while. I recently updated Visual Studio 2022 (17.14.5) and Net (to SDK 9.0.300) and I updated any older Nuget packages that were being used.

Now when calling the function, the req.Body parameter is set to NullStream and no content is received.

```
[Function("Bob")]
public async Task Post([HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequestData req)
```
Where MultiResponse is a Cosmos output binding and a standard HttpResult (the code does not get far enough to produce an output). Also, the Post verb used to be Run.

The code that I am using to call the function is

```
StringContent content = new StringContent(SerializeObject(a01.ToString()), System.Text.Encoding.UTF8, "application/xml");
HttpRequestMessage rm = new HttpRequestMessage(HttpMethod.Post, new Uri(url));
rm.Content = content;
rm.Version = HttpVersion.Version11;

using (var httpResponseMessage = await client.SendAsync(rm, HttpCompletionOption.ResponseContentRead))
```

Where SerializeObject is using XmlSerliaizer().

Just wondering if anyone would have any ideas on why it would stop working after a net update.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.