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

examples fail with TypeError: WebAssembly: Response has unsupported MIME type 'text/html' expected 'application/wasm' #439

Open
makemeunsee opened this issue Oct 30, 2024 · 2 comments

Comments

@makemeunsee
Copy link

Hello

Following https://docs.wasmer.io/sdk/wasmer-js/tutorials/xterm-js, npm run dev runs fine but the web app is dead, with only this warning and this error popping up in the browser console:

WebAssembly.instantiateStreaming failed because your server does not serve wasm with application/wasm MIME type. Falling back to WebAssembly.instantiate which is slower. Original error:
TypeError: WebAssembly: Response has unsupported MIME type 'text/html' expected 'application/wasm' index.mjs:11:47883

Uncaught CompileError: wasm validation error: at offset 4: failed to match magic number
index.mjs:11
v_ index.mjs:11
R_ index.mjs:11
index.ts:51

env info:

node -> 18.20.2
npm -> 10.5.0
@wasmer/sdk -> 0.8.0
(tried with with wasmer/sdk 0.9.0-rc1 too, same issue)

Let me know if I can provide more info to help.

Cheers,

@syrusakbary
Copy link
Member

Can you try running this folder https://github.com/wasmerio/wasmer-js/tree/main/examples/wasmer.sh ?
You'll need to replace @wasmer/sdk with the version 0.8.0 instead of the folder (../../)

@makemeunsee
Copy link
Author

makemeunsee commented Oct 30, 2024

Running wasmer.sh works out of the box.

I've compared it to the example code, and this change is enough to fix the example:

+ await init({module: WasmModule});
- await init();

Note the original line is also in https://wasmerio.github.io/wasmer-js/.

edit: and thanks for the prompt reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants