AWS Amplify throws exception while running hosted Blazor WebAssembly

0

I have developed Blazor WebAssembly App. I have uploaded App into AWS Amplify using "host without Git Provider'. When I run this App, I see the following Exception.

ly.js:1 WebAssembly resource does not have the expected content type "application/wasm", so falling back to slower ArrayBuffer instantiation. (anonymous) @ blazor.webassembly.js:1 blazor.webassembly.js:1 CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0 u @ blazor.webassembly.js:1 blazor.webassembly.js:1 Uncaught (in promise) CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0

asked a year ago315 views
1 Answer
0

The exception you're encountering indicates an issue with the WebAssembly (Wasm) content in your Blazor WebAssembly app. It appears that the Wasm file is not being recognized with the expected content type, which is causing the instantiation error.

To resolve this issue, you can try the following steps:

  1. Verify Wasm Content Type: Ensure that the Wasm file in your app has the correct content type set to "application/wasm". Double-check the file's metadata or settings to confirm this.

  2. Check Amplify Hosting Configuration: Review the configuration in AWS Amplify for hosting your Blazor WebAssembly app. Ensure that the hosting settings are correctly configured to recognize and serve Wasm files with the appropriate content type.

  3. Clear Browser Cache: Sometimes, the browser cache can cause issues with loading updated versions of Wasm files. Clear the cache in your browser and try running the app again to see if the issue persists.

  4. Update Amplify Build Settings: If you made any changes to your Blazor WebAssembly app's build process, such as modifying the build settings or including additional dependencies, make sure these changes are correctly reflected in the AWS Amplify build configuration.

  5. Test Locally: Try running your Blazor WebAssembly app locally to ensure it works as expected without any Wasm-related errors. This can help isolate the issue and determine if it's specific to the hosting environment or the app itself.

  6. Seek Amplify Support: If the issue persists, consider reaching out to AWS Amplify support for further assistance. They can help investigate the specific details of your setup and provide guidance on resolving the Wasm instantiation error.

By following these steps, you should be able to address the WebAssembly-related exception and successfully run your Blazor WebAssembly app on AWS Amplify.

answered a year ago
  • Thanks for responding to my question. Please see First Comment. How can I set "content type set to "application/wasm".

    I have 2 things

    1. Visual Studio 2002 (Blazor WebAssembly Project)
    2. AWS Amplify Console

    I did not find the place where I can set this?

  • I would like to update that I have added 'wasm' in AWS Amplify 'Rewrites and redirects' setting. Now I see different error. See Below.

    blazor.webassembly.js:1 Uncaught (in promise) Error: Error loading ICU asset. at blazor.webassembly.js:1:41012

    Any Idea on this error?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions