Closed Bug 1788162 Opened 3 years ago Closed 25 days ago

.NET 6 Blazor wasm app error "Body has already been consumed"

Categories

(Core :: JavaScript: WebAssembly, defect, P3)

Firefox 104
defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: dr.philipp.rollmann, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(9 files)

Attached image error messages

Steps to reproduce:

I created a new Blazor wasm pwa project in Visual Studio 2022 and added an update notification, like it is described here:
https://whuysentruit.medium.com/blazor-wasm-pwa-adding-a-new-update-available-notification-d9f65c4ad13

I exactly followed the instructions but did not modify service-worker.js but service-worker.published.js because I wanted to test it in production. I also added the "periodically check for updates" mentioned at the bottom of the post.

I tested Chrome, Edge, Safari and Firefox with desktop browsers.
I also tested Chrome, Edge and Firefox with android browsers.

There was a similar bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1749298) but it was fixed, while I still get the same errors.

I also posted a question at Stack Overflow but think it's a bug and therefore decided to also create this bug report.

Actual results:

Android browsers:
Everything works fine in all browsers.

Desktop browsers:
Everything works fine in Chrome, Edge and Safari but not in Firefox. Firefox gets stuck at the loading screen and displays the errors shown in attached image.

Expected results:

When I upload an update, after a while, the service worker checks for updates and all browsers show the notification button. Clicking the button in Chrome, Edge and Safari results in reloading the updated page.

The Bugbug bot thinks this bug should belong to the 'Core::JavaScript: WebAssembly' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → JavaScript: WebAssembly
Product: Firefox → Core

I do not think, it is a .NET issue, because everything is fine in Chrome, Edge and Safari.

The Chrome experienced the same issue:
blazor.webassembly.js:1 TypeError: Failed to execute 'arrayBuffer' on 'Response': body stream already read

The code in the new versions of "blazor.webassembly.js" is different now due to this bug: https://github.com/dotnet/aspnetcore/pull/42918/files#diff-a5167572a221c4bbe4fa36e4e110b39011b6e8f547ce0ab8bdd204f55201f1c0L664

So I conclude that everything can work fine in other browsers by an accident, or iirc "application/wasm"+instantiateStreaming was not handled per spec in some browsers.

The setup per https://whuysentruit.medium.com/blazor-wasm-pwa-adding-a-new-update-available-notification-d9f65c4ad13 instructions is very complicated and can deviate from yours. Can you condense all exact steps you did here? Is it possible to just zip the published artifacts?

Flags: needinfo?(dr.philipp.rollmann)
Attached file sw-registrator.js
Attached file index.html
Attached file MainLayout.razor

Hm, I uploaded 2 different folders wwwroot to enable you, to deploy a website wherever you want and also to enable you to update it.
Next, I created a detailed "Steps to reproduce in Visual Studio 2022" and to keep it as simple as possible, I uploaded the modified files, so you would not have to modify the code but simply replace the files.
My last step was to check everything and suddenly everything worked fine in all browsers including Firefox. (So, everything I uploaded was unnecessary.)
Why did this happen? I don't know. The only thing I changed is switching from "release" update channel (Firefox 104) to "beta" (Firefox 105.0b7).

Flags: needinfo?(dr.philipp.rollmann)

My last step was to check everything and suddenly everything worked fine in all browsers including Firefox. (So, everything I uploaded was unnecessary.)
Why did this happen? I don't know. The only thing I changed is switching from "release" update channel (Firefox 104) to "beta" (Firefox 105.0b7).

There is the mozregression -- if you have time you can check when/why everything started working

The severity field is not set for this bug.
:rhunt, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(rhunt)
Severity: -- → S3
Flags: needinfo?(rhunt)
Priority: -- → P3

Cleaning up old inactive bugs. Please re-open if this is still an issue.

Status: UNCONFIRMED → RESOLVED
Closed: 25 days ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: