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

CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0 #40953

Closed
pravinparab opened this issue Aug 21, 2020 · 2 comments

Comments

@pravinparab
Copy link

@pravinparab pravinparab commented Aug 21, 2020

Hi,

While running angular application with wasm file , I am getting below error

CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0

Please check below code

private instantiateWASM() {
fetch('hello-wasm2/hello_wasm2_bg.wasm', { method: 'GET', mode: 'no-cors'})
.then(response => response.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, this.importObject))
.then(mod => {
console.log("In WASM");
this.wasmModuleRef = mod.instance.exports;
})
.catch(err => console.log(err));
}

@randall77
Copy link
Contributor

@randall77 randall77 commented Aug 21, 2020

I don't think this is a Go issue. You're trying to load a webassembly file, but it is a html file.

See WebAssembly/spec#1031

@randall77 randall77 closed this Aug 21, 2020
@benbatya
Copy link

@benbatya benbatya commented Sep 18, 2020

make sure that your web server's redirect filter excludes .wasm files.
I finally discovered that was the reason why my wasm files were being delivered as html.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.