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

"Uncaught (in promises) TypeError" with 0.4.x from browser #109

Open
MattMatic opened this issue Nov 21, 2024 · 2 comments
Open

"Uncaught (in promises) TypeError" with 0.4.x from browser #109

MattMatic opened this issue Nov 21, 2024 · 2 comments

Comments

@MattMatic
Copy link

MattMatic commented Nov 21, 2024

I have projects that work with HBJS 0.3.6 (hbjs.js and hb.wasm).

However, updating both hbjs.js + hb.wasm to version 0.4.0+ produces an error:

Uncaught (in promise) TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object

This even happens with the repository examples/nohbjs.html and examples/hbjs.example.html with no modifications.

Details:

  • Occurs with any 0.4.x
  • Win11Pro, Edge
  • Occurs with local html file (& remote hb.wasm), or running from local web server.
  • FWIW, projects are single HTML file with JavaScript, and nothing extra, using same WebAssembly.instantiate as in HBJS Demo/index.html
  • Fails also with the WebAssembly.instantateStreaming method outlined in README.md
  • (Similar error with Safari - only with 0.4.x, not 0.3.6)

Any clues would be very helpful! Thank you 😊

@khaledhosny
Copy link
Contributor

I probably broke it with #97. I don’t really understand much of this, I’m afraid.

@MattMatic
Copy link
Author

MattMatic commented Nov 25, 2024

More detail on the error: Uncaught (in promise) TypeError: WebAssembly.instantiate(): Import #0 "wasi_snapshot_preview1": module is not an object or function

The wasi_snapshot_preview1 is new to 0.4.x. I can see it, along with some other hooks, in a hex dump of hb.wasm,

But it might be due to including something that needs a standard file I/O hook, or some other environment hook for standard system calls. action_abort and action_terminate seem to be linked to this (I added --profiling-funcs to the em++ parameters then used wasm-objdump -d hb.wasm > hb.wasm.dis to get a disassembly)

Trying to understand it all myself! 😊

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

2 participants