runtime: "Failed to load response data" after non-200 http request with Blazor HttpClient in Chromium based browsers
Describe the bug
Http response data not available if request ends with non-200 http status code (tested with 500).
“Failed to load response data” message in Network tab in Chrome developer tools and net::ERR_ABORTED 500 error in console.
Same request executed by hand shows response data in Response tab in Network tab.
fetch('https://localhost:5001/WeatherForecast')
After some investigation (by debugging) i found that error may be due to passing AbortController as signal
parameter to fetch() method. But i can’t found source code for this.
Reproducible in Chromium based browsers, tested in:
- Chrome 85.0.4183.121
- Microsoft Edge 86.0.622.38
Works fine in Firefox 80.0.1 (64-bit)
To Reproduce
repro: https://github.com/amityagov/blazor-http-500-aborted
WeatherForecastController::Get
modified so it will throw exception after invocation.
dotnet run
- Open Chrome Developer Tools
- Open https://localhost:5001/fetchdata
- Request will be executed as page opened
Exceptions (if any)
Request info in browser console: GET https://localhost:5001/WeatherForecast net::ERR_ABORTED 500
Further technical details
dotnet --info .NET SDK (reflecting any global.json): Version: 5.0.100-rc.1.20452.10 Commit: 473d1b592e
Runtime Environment: OS Name: Windows OS Version: 10.0.19041 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.100-rc.1.20452.10\
Host (useful for support): Version: 5.0.0-rc.1.20451.14 Commit: 38017c3935
.NET SDKs installed: 3.1.402 [C:\Program Files\dotnet\sdk] 5.0.100-preview.8.20417.9 [C:\Program Files\dotnet\sdk] 5.0.100-rc.1.20452.10 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: old runtimes skipped Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0-preview.7.20364.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0-preview.8.20407.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.0-rc.1.20451.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0-preview.8.20411.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.0-rc.1.20452.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23 (19 by maintainers)
@kjpou1 https://imgur.com/a/Xk4meEX
@kjpou1 Hello, No, no redirects intended. Just data loading with ajax.
I did not find any information about Chrome, this is just my conclusion based on a comparison of the browser behavior of Firefox and Chrome. But in the following article there is an indirect confirmation of the situation.
https://groups.google.com/a/chromium.org/g/chromium-dev/c/Fal1ZJnTgGQ/m/UDdxbrf_Rv4J
Maybe load interuption caused by exception thrown after calling response.EnsureSuccessStatusCode()
This is call stack from console. I do not know how, but it is different from the one presented by you.