AssemblyScript / binaryen.js

A buildbot for browser & Node.js builds of Binaryen, a compiler infrastructure and toolchain library for WebAssembly.
http://github.com/WebAssembly/binaryen
Apache License 2.0
355 stars 48 forks source link

Huge wall of text printed on uncaught exceptions in Node.js #94

Open lastmjs opened 1 month ago

lastmjs commented 1 month ago

There is a problem that binaryen.js seems to be embodied with in Node.js where the entire minified contents of binaryen.js is printed to the terminal on uncaught exceptions. The issue has been reported in multiple places, and the root of the issue seems to be in Node.js. The Node.js issue hasn't seen any activity.

I'm hoping raising the issue here might lead to some insight, workarounds, or finally getting it fixed in Node.js.

Here are the existing issues:

CountBleck commented 1 month ago

We're aware of this issue (which is ultimately Node's fault). --enable-source-maps used to work, but it stopped working since v16 or maybe v18 (I don't remember off the top of my head, and I don't know why this changed).

I'm pretty sure the problem would be fixed if the Wasm wasn't bundled as a large base64 string, but I don't know whether that'd break existing uses of binaryen.js.

CountBleck commented 1 month ago

@lastmjs after playing around with fnm, Node v15.14.0 prints out the large stack trace, but using --enable-source-maps, I get this instead:

TypeError: binaryen.createModule is not a function
    at file:///home/lordblumiere/Projects/bjstest/index.js:3:25
    at <anonymous> (<anonymous>)

This doesn't work for v16.20.2, however; --enable-source-maps does nothing to fix the issue.

CountBleck commented 1 month ago

It seems to have broken between v16.17.1 and v16.18.0.

kripken commented 1 month ago

With https://github.com/WebAssembly/binaryen/pull/6764 landed, this should be fixed in the next build of binaryen.js, but please verify that and let me know if not.