Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosted Blazor Web App throws error when opening (invalid cache?) #54285

Closed
1 task done
Code-Chops opened this issue Mar 1, 2024 · 7 comments
Closed
1 task done

Hosted Blazor Web App throws error when opening (invalid cache?) #54285

Code-Chops opened this issue Mar 1, 2024 · 7 comments
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue

Comments

@Code-Chops
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When opening our hosted Blazor app our customers get an exception.

Clearing the cache fixes the problem. I think this problem occurs because the old DLLs are still in the cache storage. What is the problem here? And what can I do about it? At the moment we have to tell our customers to clear the cache in the developer window, which is unwanted of course. Thanks in advance!

Expected Behavior

A working Blazor Web App

Steps To Reproduce

No response

Exceptions (if any)

dotnet.runtime.8.0.2.xpxg2k6ml2.js:3 MONO_WASM: instantiate_wasm_module() failed LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable
dt @ dotnet.runtime.8.0.2.xpxg2k6ml2.js:3
dotnet.js:3 MONO_WASM: LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable
u @ dotnet.js:3
blazor.web.js?v=2.3.16:1 Error in mono_download_assets: LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable
Rr @ blazor.web.js?v=2.3.16:1
4dotnet.js:3 Uncaught (in promise) LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable
dotnet.runtime.8.0.2.xpxg2k6ml2.js:3 Uncaught (in promise) LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable
2app.dentalrules.nl/:1 Uncaught (in promise) LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable
blazor.web.js?v=2.3.16:1 Uncaught (in promise) Error: Failed to start platform. Reason: LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable
at ei (blazor.web.js?v=2.3.16:1:164030)
blazor.web.js?v=2.3.16:1 Uncaught (in promise) LinkError: WebAssembly.instantiate(): Import #42 module="env" function="dlopen": function import requires a callable

.NET Version

8.0.201

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Mar 1, 2024
@javiercn
Copy link
Member

javiercn commented Mar 2, 2024

@Code-Chops thanks for contacting us.

You can use Clear-Site-Data to wipe out existing storage for the app, or add a small script to the page before Blazor loads to clear the cache manually if you are running into issues.

@Code-Chops
Copy link
Author

Thank you very much! Do you know why this is happening? Shouldn't Blazor check if newer versions are available and clear the cache accordingly?

@Code-Chops
Copy link
Author

And what cache are we talking about? Because we clear the 'Cache storage' and the problem still exists

@MackinnonBuck
Copy link
Member

Thanks for reaching out. Just a few questions:

  1. Does your app use a service worker?
  2. Could you provide us with information about your deployment environment?
  3. Does the issue occur even when loading the page in a private browser window?

If possible, please also provide us with a minimal repro project hosted as a public GitHub repository so we can look into this issue further. Thanks!

And what cache are we talking about? Because we clear the 'Cache storage' and the problem still exists

There is a hash in blazor.boot.json that Blazor uses to determine whether the assets have changed and need to be re-downloaded.

@MackinnonBuck MackinnonBuck added Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue labels Mar 4, 2024
@Code-Chops
Copy link
Author

Sorry for the late response. We finally got it working by adding an ETag in our headers with the current version of the application as value. But now we get the following warning in the console:
dotnet.runtime.8.0.3.b85ar3xvhg.js:3 MONO_WASM: The version of dotnet.native.js is different from the version of dotnet.js!

Can we ignore this error?

@MackinnonBuck

  1. Our app does not include a service worker
  2. We deploy in Kubernetes using Azure DevOps.
  3. The error also occurs in an incognito window.

It was difficult for me to recreate a repro.

Thank you!

@bytefish
Copy link

bytefish commented Jul 17, 2024

@Code-Chops I get this error aswell:

logging.ts:26  MONO_WASM: The version of dotnet.native.js is different from the version of dotnet.js!

And I am wondering, if this error can be ignored or not.

I've just updated to .NET 8 and deleted the obj / bin folders, cleared all site data, and restarted Visual Studio to no success.

@omni-htg
Copy link

omni-htg commented Oct 9, 2024

During the upgrade to 8.0.10 from 8.0.8 experiencing the same issues as @bytefish above.
Reported a new issue #58313 for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. Needs: Repro Indicates that the team needs a repro project to continue the investigation on this issue
Projects
None yet
Development

No branches or pull requests

5 participants