Azure / Azure/azure-functions-dotnet-worker

Behavioural changes when using request body as the request content for a chained http request

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

Description

### Description

We have a C# function app calling a Java function app. The C# function app received a request and is supposed to just use the request body as the content for the HttpRequest towards the Java function. While this works in .NET 8 non isolated worker model functions, in dotnet-isolated the request body appears to be empty on the Java function side. This only occurs with some webservers. Reading the entire HttpRequest in the C# Function and passing it on as a StringContent "fixes" this behaviour, though now one would have to read every request body into a string, which
is not what we want when uploading large json files. It also does not seem only Stream related, as a FileStream which is read in the function can be passed as StreamContent to a backend service.I have attached a minimum repro, I can provide the confidential request url if needed.

[TestJasper.zip](https://github.com/user-attachments/files/16506852/TestJasper.zip)

### Steps to reproduce

Try to send a HttpRequestData Body via a new HttpRequestMessage as Content fails on dotnet-isolated

###Educated guesses
HttpRequest.Body implementation of the Stream type changed from https://github.com/dotnet/aspnetcore/blob/main/src/Http/WebUtilities/src/FileBufferingReadStream.cs to
https://github.com/dotnet/aspnetcore/blob/main/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs
when migration in-process-> dotnet isolated

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the attached TestJasper.zip minimum repro and compare the in-process and dotnet-isolated request paths. Inspect how HttpRequestData Body is used as HttpRequestMessage content, including the HttpRequest.Body stream implementations linked in the issue; done means forwarding large request bodies to the Java function without first reading them into a string.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.