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

Wasm decoding failed #120

Open
jjenzz opened this issue Mar 1, 2018 · 5 comments
Open

Wasm decoding failed #120

jjenzz opened this issue Mar 1, 2018 · 5 comments

Comments

@jjenzz
Copy link

jjenzz commented Mar 1, 2018

I am trying to get this up and running and I'm getting the following error:

CompileError: AsyncCompile: Wasm decoding failed: expected magic word 00 61 73 6d, found 3c 21 44 4f @+0

The only code I have atm is:

this.recognizer = new Worker('js/recognizer.js');
this.recognizer.onmessage = this.handleReady; // this method is empty atm
this.recognizer.postMessage({});

All files from the webapp/js directory are in my public js directory.

Any idea where I am going wrong?

@syl22-00
Copy link
Owner

syl22-00 commented Mar 1, 2018

I believe that means pocketsphinx.wasm was not found. You can set the location in your postMessage call: this.recognizer.postMessage({'pocketsphinx.wasm': 'path/to/pocketsphinx.wasm'});.

@jjenzz
Copy link
Author

jjenzz commented Mar 2, 2018

@syl22-00 I'm not sure that is the issue because the following suggests it found something in the wasm file that it wasn't expecting:

expected magic word 00 61 73 6d, found 3c 21 44 4f @+0

Furthermore:

image

image

@syl22-00
Copy link
Owner

syl22-00 commented Mar 7, 2018

This is indeed strange, is it a file that you compiled yourself? It does not have the correct header and is only 1.2KB big. The file in the repo is 467kB big.

@Venryx
Copy link

Venryx commented Sep 8, 2019

Got this same error for the opus-media-recorder library. (this is the only result on the internet for the given "expected magic word..." error message!)

For me, the problem was that I was using the following:

app.use(require("connect-history-api-fallback")({
	rewrites: [
		{
			from: /^(.(?!\.(html|js|css|png|jpg)))+$/, // paths with these extensions will NOT be redirected to "index.html""
			to(context) {
				return "/index.html";
			},
		},
	],
}));

Notice that it's rewriting any url's that don't end in the special resource-extensions (html, js, etc.) with the url for the homepage. The problem is that I forgot to add .wasm to that list, meaning that when the browser requested the .wasm files, it was receiving the index.html file instead.

Adding .wasm to that list resolved the issue.

@jackbilestech
Copy link

3c 21 44 4f @+0 in ascii is <!DO whihc is the header of a HTML file. So the file you're trying to load is not found in the path given. You'll have to statically deploy the relevant files first in order for the HTTP request to be made.

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

4 participants