whisper.cpp
whisper.cpp copied to clipboard
WASM: Uncaught TypeError: e.data.handlers is not iterable
Hi- im trying to get WASM running on my local machine using the latest code (e70e5c8b53faec6abbf0170f1e9a195f4dfccaab) but when i load the page in my browser, i see this issue in web console:
worker sent an error! http://localhost:8081/libwhisper.worker.js:1
Attached is a screenshot,

Im running a stock nginx config with this server setting:
server {
listen 8081;
server_name _;
root /opt/whisper.cpp_wasm;
location / {
index index.html index.htm;
add_header 'Cross-Origin-Embedder-Policy' 'require-corp';
add_header 'Cross-Origin-Opener-Policy' 'same-origin';
}
}
Strangely, i can load a model and audio file but when i press the transcribe button i see this error:
Uncaught TypeError: Module.init is not a function
at onProcess ((index):449:39)
at HTMLButtonElement.onclick ((index):157:61)
onProcess @ (index):449
onclick @ (index):157

I'm getting exactly the same issue hosting locally with Node/Express.js
const express = require("express");
const app = express();
const port = 3000;
app.use(function (req, res, next) {
res.header("Cross-Origin-Embedder-Policy", "require-corp");
res.header("Cross-Origin-Opener-Policy", "same-origin");
next();
});
app.use(express.static("public"));
app.listen(port, () => {
console.log(`Listening on port ${port}`);
});
Strange. The only difference that I see compared with the nginx setup is that I have the keyword always and I use SSL:
server {
listen 443 ssl;
server_name whisper.ggerganov.com;
client_max_body_size 10M;
large_client_header_buffers 4 512k;
ssl_certificate /etc/letsencrypt/live/ggerganov.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ggerganov.com/privkey.pem;
add_header Cross-Origin-Embedder-Policy 'require-corp' always;
add_header Cross-Origin-Opener-Policy 'same-origin' always;
root /var/www/html/whisper;
index index.html;
}
Does the https://whisper.ggerganov.com work for your? Want to make sure the issue is not in the browser.
Does the https://whisper.ggerganov.com/ work for your? Want to make sure the issue is not in the browser.
yes, it does. I will try to setup SSL and see if it solves it. Thanks.
I generated a self-signed cert and still same problem. If it is an SSL issue perhaps I need a valid cert too

No success here either, hosting over HTTPS via Heroku. https://whisper.ggerganov.com/ works for me. Same behaviour in Firefox and Chrome.
looks like https://whisper.ggerganov.com/ is running an older commit (b21213c2)- i will try that version
same error on that commit

Which emsdk version are you using?
I am using 3.1.2: emsdk list --uses
Also, you do have all 3 files in your HTTP root, correct?
- index.html
- libwhisper.worker.js
- whisper.js
Maybe try to download my versions of these 3 files from whisper.ggerganov.com and put them in your HTTP server and see if it works?
that does work! i'll run a diff on the files and see if i can pin-point what's going on here
I think that updating to emsdk 3.1.2 should resolve this.
Closing this, but if the issue persist -- let me know
I actually ran into similar issue, and solved it by pulling js file from https://whisper.ggerganov.com/ Updating to emsdk 3.1.2 didn't help.
Strange, all I'm doing is emcmake cmake .. + make as shown in the examples. Not sure why it does not work for you.
Can anyone else confirm it works for them?
this is the error i get:
