Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object #4399

Closed
UebelAndre opened this issue Jan 9, 2025 · 0 comments
Labels

Comments

@UebelAndre
Copy link
Contributor

Describe the Bug

I was working on bazelbuild/rules_rust#3174 and noticed when I bumped wasm-bindgen from 0.2.93 to 0.2.95 I started seeing:

[TypeError: WebAssembly.instantiate(): Imports argument must be present and must be an object]

I know Bazel is not a consideration for this repo but I'm still hoping someone could shed some light on why I might be seeing this issue on 0.2.95. I'm currently trying to bump to 0.2.99 and see the same failure there.

I've tried using the following diff and all it did was change the error slightly

diff --git a/extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.js b/extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.js
index 61fc3839..f8dbfdbb 100644
--- a/extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.js
+++ b/extensions/wasm_bindgen/rules_js/test/hello_world_wasm_test.js
@@ -15,7 +15,7 @@ const main = async function (typ, dir) {
     const buf = fs.readFileSync(wasm_file);
     assert.ok(buf);

-    const res = await WebAssembly.instantiate(buf);
+    const res = await WebAssembly.instantiate(buf, {});
     assert.ok(res);
     assert.strictEqual(res.instance.exports.double(2), 4);
 };
[TypeError: WebAssembly.instantiate(): Import #0 module="wbg" error: module is not an object or function]

A clear and concise description of what the bug is.

Steps to Reproduce

I do not have a repro outside of Bazel but with bazelbuild/rules_rust#3174 the error can be reproduced:

  • navigate to extensions/wasm_bindgen
  • run bazel test //...

Expected Behavior

There should be no error caused by the test.

Actual Behavior

The test should pass as it used to on 0.2.93.

@UebelAndre UebelAndre added the bug label Jan 9, 2025
@rustwasm rustwasm locked and limited conversation to collaborators Jan 9, 2025
@daxpedda daxpedda converted this issue into discussion #4400 Jan 9, 2025

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

1 participant