whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

WASM: Uncaught TypeError: e.data.handlers is not iterable

Open eschmidbauer opened this issue 3 years ago • 13 comments
trafficstars

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, image

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

Screen Shot 2022-11-17 at 10 39 15 AM

eschmidbauer avatar Nov 17 '22 15:11 eschmidbauer

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}`);
});

SageRalph avatar Nov 17 '22 16:11 SageRalph

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.

ggerganov avatar Nov 17 '22 16:11 ggerganov

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.

eschmidbauer avatar Nov 17 '22 16:11 eschmidbauer

I generated a self-signed cert and still same problem. If it is an SSL issue perhaps I need a valid cert too image

eschmidbauer avatar Nov 17 '22 16:11 eschmidbauer

No success here either, hosting over HTTPS via Heroku. https://whisper.ggerganov.com/ works for me. Same behaviour in Firefox and Chrome.

SageRalph avatar Nov 17 '22 16:11 SageRalph

looks like https://whisper.ggerganov.com/ is running an older commit (b21213c2)- i will try that version

eschmidbauer avatar Nov 17 '22 16:11 eschmidbauer

same error on that commit image

eschmidbauer avatar Nov 17 '22 16:11 eschmidbauer

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?

ggerganov avatar Nov 17 '22 17:11 ggerganov

that does work! i'll run a diff on the files and see if i can pin-point what's going on here

eschmidbauer avatar Nov 17 '22 17:11 eschmidbauer

I think that updating to emsdk 3.1.2 should resolve this. Closing this, but if the issue persist -- let me know

ggerganov avatar Nov 26 '22 20:11 ggerganov

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.

Xavier-i avatar Dec 01 '22 19:12 Xavier-i

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?

ggerganov avatar Dec 01 '22 20:12 ggerganov

this is the error i get: image

eschmidbauer avatar Dec 01 '22 21:12 eschmidbauer