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

WebAssembly streaming API fails with inspector #21508

Open
peter-jerry-ye opened this issue Dec 8, 2023 · 5 comments
Open

WebAssembly streaming API fails with inspector #21508

peter-jerry-ye opened this issue Dec 8, 2023 · 5 comments
Labels
bug Something isn't working correctly debugger Chrome DevTools inspector/debugger integration

Comments

@peter-jerry-ye
Copy link

  • Steps to reproduce by slightly altering the example of https://docs.deno.com/runtime/manual/runtime/webassembly/using_streaming_wasm

    • Run curl https://wpt.live/wasm/incrementer.wasm -o incrementer.wasm to get the wasm file
    • Create a file named "index.ts" with following contents:
    const { instance, module } = await WebAssembly.instantiateStreaming(
      fetch(new URL("./incrementer.wasm", import.meta.url)),
    );
    const increment = instance.exports.increment as (input: number) => number;
    console.log(increment(41));
    • Run deno run --inspect-brk --allow-read ./index.ts
    • Visit chrome://inspect to connect to the debugger and execute the program
  • Expected output

    • Log 42 on the console
  • Actual output

error: Uncaught (in promise) TypeError: WebAssembly.compile(): Argument 0 must be a buffer source
    at eventLoopTick (ext:core/01_core.js:178:11)

Also tested with VSCode debugger

  • Version:
    • Deno 1.38.4
    • Chrome 120.0.6099.71
    • VSCode 1.84.2
    • macOS Sonoma 14.0
@dsherret dsherret added bug Something isn't working correctly debugger Chrome DevTools inspector/debugger integration labels Dec 8, 2023
@mcgear
Copy link

mcgear commented Mar 19, 2024

Any news on this? I am getting the same trying to use @deno/graph wasm in a solution.

@Hajime-san
Copy link
Contributor

related denoland/vscode_deno#708

@peter-jerry-ye
Copy link
Author

peter-jerry-ye commented Dec 11, 2024

FYI, a workaround for this is:

const response = await fetch(new URL("./incrementer.wasm", import.meta.url));
const buffer = await response.arrayBuffer();
const { instance, module } = await WebAssembly.instantiateStreaming(
  buffer
);
const increment = instance.exports.increment as (input: number) => number;
console.log(increment(41));

There must be a mismatch with the type check or implementation

@0f-0b
Copy link
Contributor

0f-0b commented Dec 11, 2024

Could this issue be caused by the --wasm-test-streaming V8 flag?

@peter-jerry-ye
Copy link
Author

Could this issue be caused by the --wasm-test-streaming V8 flag?

I'm not quite sure. I tried with --no-wasm-test-streaming and nothing changed. It could be me using it the wrong way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly debugger Chrome DevTools inspector/debugger integration
Projects
None yet
Development

No branches or pull requests

5 participants