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

worker sent an error! undefined:undefined: undefined #104

Open
erjoalgo opened this issue Jan 31, 2025 · 1 comment
Open

worker sent an error! undefined:undefined: undefined #104

erjoalgo opened this issue Jan 31, 2025 · 1 comment

Comments

@erjoalgo
Copy link

erjoalgo commented Jan 31, 2025

Hello,

I'm trying the example server.js, when I navigate to http://localhost:9091/, all I see is:

worker sent an error! undefined:undefined: undefined

Image

When examining the exception in the debugger, the onerror argument doesn't appear to contain any error message, other than type: 'error':

Image

How do I get a more meaningful error message to help debug this further?

I'm running server.js as node server.js

@erjoalgo
Copy link
Author

erjoalgo commented Jan 31, 2025

After some debugging, I found that the _scriptName is undefined, and the new Worker(...) was being passed an undefined script name:

Image

There is an attempt to define it in the snippet below, but both the document and __filename are undefined in my browser:

var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;

After hard-coding the _scriptName, I get another, more interesting error:

if (!_scriptName) {
  _scriptName = "/src/stockfish.js"
  // throw new Error("undefined _scriptName!");
 }
Stockfish 16.1 WASM Multithreaded by the Stockfish developers (see AUTHORS file)
worker sent an error! http://localhost:9091/src/stockfish.js:38: Uncaught RuntimeError: memory access out of bounds

Image

I am beginning to wonder whether I'm missing something important about running the examples, or whether the examples are up-to-date with the latest code since I'm facing several issues.

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

1 participant