Hey everyone,
I'm trying to compile a component without any WASI imports as they're not necessary in this case. I'm using target wasm32-unknown-unknown
and I'm getting this error,
error: failed to decode world from module
Caused by:
0: module was not valid
1: module requires an import interface named `__wbindgen_placeholder__`
Here is the WIT file,
package graph:api@0.0.1;
interface data-store {
resource db {
constructor();
scan: func(path: tuple<string, string>) -> list<u8>;
schema: func(path: tuple<string, string>) -> list<u8>;
}
}
world function {
enum error {
none,
deserialize,
}
export run-query: func() -> result<tuple<list<u8>, list<u8>>, error>;
import data-store;
}
I've been going around in circles with this for a few hours. Any help would be greatly appreciated.
Thanks
I'd also add that the component does actually compile and a wasm
file is created, but the error appears after compilation is finished and the component cant be compiled in the runtime.
the mention of wbindgen means that you are using some rust crate that detects "wasm32-unknown-unknown" and assumes that means wasm-bindgen wasm targeting browsers
ask cargo tree what depends on wasm-bindgen
(I hope my information is still up to date, wbindgen_placeholder seems unfamiliar but so far all wbindgen errors meant something depends on wasm-bindgen)
There's no dependency on wasm-bindgen
. If I compile with the default wasm32-wasi
i get this error when trying to run the component,
component imports instance `wasi:cli/environment@0.2.0`, but a matching implementation was not found in the linker
As Roman points out, the most likely cause is that one of your dependencies interprets the wasm32-unknown-unknown
target to mean "I'm running in a browser" which is not what you want. Without seeing more about your project (e.g., Cargo.toml file), it's hard to say for sure where the issue is coming from.
Last updated: Nov 25 2024 at 19:03 UTC